Converting 3D models for AfterNow Prez ==================================== [TOC] ## Background AfterNow Prez suport 2 type of 3D content. The standard 3D format __GLTF / GLB__ and __Unity 3D assetbundles__. In the world of 3D models, there are no standards like JPG, PNG or gif for images. You will find dozens of 3D models format. There is a format for each tool that creates a 3D model, and they are not compatible with each other. The most widely used format to exchange 3D files between 3D software is __FBX__ and __OBJ__. OBJ is very basic. FBX support all the features needed but its own by Adobe and work well mainly with Adobe products or Adobe partners. There are two new formats one is __GLTF__ an open-source format from the Khronos Group, and __USDZ__ from Apple. USDZ only works in the Apple echo system, which means recent iPhones and iPads. We have chosen GLTF / GLB because of its open standard and backing by companies like Microsoft and Google. If you need to optimize your presentation for performance, you have very detailed 3D models or a very long presentation. We suggest using Unity3D assetbundles. See below. ## GLTF / GLB A GLTF file is a zip file with all the 3D model elements in it. A GLB file is a binary file that doesn't need to be unzipped and can directly be used in various apps. ### GLTF To make it easy to import GLTF in AfterNow Prez we created an automatic converter to GLB. To upload the GLTF follow those steps: - Unzip the GLTF files on your computer (right-click on the file and select *Extract All*) - Open a presentation - Select a slide where you want the 3D object - Select all the files in the GLTF folder and Drag Drop them in your slide. AfterNow Prez will automatically convert it to a GLB and upload it in your presentation. -- video -- ### GLB There is no conversion needed. Just upload them directly in your slide. ### FBX FBX is a popular format for 3D models to upload a 3D model in FBX format to AfterNow Prez. It needs to be converted to a GLB or GLTF. You will find online converters: https://www.creators3d.com/online-viewer Or command line converters that works better but much harder to use: https://github.com/facebookincubator/FBX2glTF You can also use 3D applications like [Blender](https://www.blender.org/) or [Maya](https://www.autodesk.com/products/maya/overview?support=ADVANCED&plc=MAYA&term=1-YEAR&quantity=1) to import your FBX and export it to a GLB that you can upload in AfterNow Prez. After the conversion you can test your GLB at: [ThreeJS GLTF viewer](https://gltf-viewer.donmccurdy.com/) [BabylonJS sandbox](https://sandbox.babylonjs.com/) ## Unity AssetBundle Unity3D is an application to create games and AR/VR applications. It's the application we used to create AfterNow Prez Remote. One of its features is importing a wide range of 3D model formats and optimizing them for performance. First, you will need to create a Unity package using Unity3D then convert it to a Unity3D assetbundle. ### Unity package Import your 3D model in Unity3D and export it as a package. Here are details steps: - Open Unity3D - Create a Project - Drag Drop your 3D object in Unity3D in the *Assets* folder. - Unity3D will import the 3D model - Place the imported 3D model in your scene - Adjust the size and orientation. - In the *Assets* folder, create a new folder called: *Prefabs* - Drag-drop the 3D model gameobject from your scene in the *Prefabs* folder. - This will create a prefab that you can export - Right-click on your prefab and select export -> package - Name your package exactly like the prefab name - If your 3D object as dependencies, make sure they are all in the Prefabs folder. - Download it on your computer. - Upload the unity package in your presentation. :::danger The name of your prefab need to be the same as your unitypackage file name. ::: <!-- The prefabs should be in a folder named "Prefabs" ."Assets/Prefabs". The name of prefab should be the same as of the gameobject it was made from. all dependency files should be inside Prefabs folder only dependency files can also be in a subfolder named "myprefabname-dependency". "Assets/Prefabs/myprefabname-dependency".(for this build this is not mandatory). The naming convention for assetbundle is *-android.assetbundle and *-uwp.assetbundle. (* = name of the prefab). --> ### Unity AssetBundle To create Unity Assetbundle there are 2 options. The first is to use our automated AssetBundle generator. #### Auto generate AssetBundle We have setup a Unity3D system that automatically generate AssetBundle from Unity3D packages. It will generate them with the proper version of unity and the Android Platform as well as the Windows Platform. You can upload our Unity Package directly in the presentation. It will then be sent for conversion. This can take up to 10 min, during that time the message `Processing` will display. Once done you will see the 3D icon. :::warning Be Patient the converson on UnityPackage to AssetBundle can take up to 10 minutes to complete. ::: #### Manualy export AssetBundle Install Unity 2018.4, create a project and set it up for your target platform: Android or Quest. Import the Unity3D package, add the prefab to a bundle then export the assetbundle for your platform. I personally use a small script in /Assets/Editor for Hololens: ```C# using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; public class BundleBuilder : Editor { [MenuItem("AssetsItem/ BuildTarget AssetBundles")] static void BuildAllAssetBundles() { BuildPipeline.BuildAssetBundles ( @"Assets/AssetBundles", BuildAssetBundleOptions.None, BuildTarget.WSAPlayer); } } ``` and change `BuildTarget.WSAPlayer` with `BuildTarget.Android` for Quest.