This is a guest post by Branden Coker, an artist from AGI with many things to his credit, including the glTF model for NORAD Tracks Santa. Special thanks to 3dben for Blender and 3DS Max tips. - Patrick
Cesium uses the web-friendly glTF format for 3D models. Cesium ion provides an online model converter that allows us to upload COLLADA and OBJ models and their textures to produce a hosted glTF model for use in Cesium. This blog post is a series of tips for authoring 3D models and then exporting them to COLLADA to get the best performance and robustness.
- Use a single vertex map for all textures. Multiple textures can be used to maximize use of the UV space, but all textures should share a single UV map.
- Use texture atlases instead of individual textures. This minimizes the number of files that need to be downloaded at runtime and allows the engine to batch draw calls, which improves performance.
- Although the guaranteed maximum texture size in WebGL is only 64x64, all modern systems support 2048x2048, which is a reasonable upper bound for textures for glTF assets.
- Use mipmapping. This improves visual quality and runtime performance, especially for large texture atlases that would otherwise have poor memory coherence.
- Use power-of-two texture dimensions. If a non-power-of-two texture is using mipmapping, the engine will have to resize the texture at runtime. This does not imply that the width and height need to be the same, only that each needs to be a power-of-two.
- Do not include any unnecessary vertex attributes. They may only trivially increase the size of a COLLADA export, but can bloat the final glTF asset. Since glTF does not have per-attribute indices, attributes need to be stored for each vertex.
- Use fewer nodes and meshes. In general, performance will be better when few large meshes are used, instead of many small meshes.
- Disable cameras, lights, vertex colors, and vertex weights as well as all application profiles in the COLLADA exporter to avoid exporting any unused data.
- Delete camera and light items.
- Delete any unused transform, rotation, and scale matrices from mesh items as these will export even if there is no animation.
- Instanced keyframes must be baked before export. These occur when instances are created from animated mesh items. Although they will animate as expected in Modo, they will not export unless baked.
- Do not use the Bake Matrices COLLADA exporter option for models with animations because the exported models will not be animatable.
- For models with textures, check the Include UV Textures and Include Material Textures COLLADA exporter option to make sure they are exported.
- Texture images need to be web-friendly, e.g. jpg or png.
- Move the textures to where the .max file is located.
- Name the material maps in the material editor to match the texture image they are linking to.
- Export the FBX to the same folder as the texture maps.
- Import to Blender and export to COLLADA with the above texture options.
Troubleshooting COLLADA-to-glTF Conversion
For a few conversion tricks to aid with buggy COLLADA exporters, see the Troubleshooting section of the Cesium 3D Models Tutorial for developers.