How to prepare 3D files for WebAR

File Format and Size
• GLB is the file format for WebAR
• Find here some tips regarding the preparation of the models: https://www.8thwall.com/glb • The total files size should be kept under 15MB

3D model preview
• A good web tool to test exported GLB models is https://gltf-viewer.donmccurdy.com/
• Here you can test how the exported files look and if the embedded animations play correctly.

Images/Textures
• All the images used in the AR scene should have ‘Power of 2’ dimensions (e.g. 512x512, 1024x1024, 2048x2048, etc..)
• This also counts for the textures embedded in the 3D models
• If dimensions are not power-of-2, textures will be automatically resized on the fly on user’s phone. This will affect the performance of the experience.

Mapping values
• 3D models are rendered on the web by a library called ThreeJS; this has some limitiations.
• ThreeJS does not support different mapping values (offset - scale) for textures on the same exported model.
• Offset and scale are automatically default to one of the ‘maps’ included in the model, with the following priority:
1. color map
2. specular map
3. displacement map
4. normal map
5. bump map
• In practice, make sure Color map, Normal map, Bump map (etc..) have the same offset and scale values

Animations
‍
• While animating a model, avoid scaling objects/entities in scene to (0 0 0)
• When entities are scaled to (0 0 0), a warning is triggered in the background every ~5ms, this affects performance of the experience
• Solution: replace with (0.001 0.001 0.001)
• This also counts for animations embedded in glb 3D models
• If you want to use vertex animations, Morph Targets can be embedded in the glb file and previewed in the online tool mentioned above.

Spritesheets on 3D models
• It is possible to apply a spritesheets (see image below) on a 3D models and animate it in two ways:
1. An external spritesheet file can be applied as a texture to the mesh by script. In this case avoid to embed any texture in the 3D model to save memory
2. The spritesheet can be embedded as texture in the 3D model
• In both cases, the UV of the 3D model should be prepared on a single frame of the animation.
• (Keep a power-of-2 resolution)