3D model essentials
3D models are imported into decentraland in glTF format. There are a number of supported features that these models can include. This section goes over ways to make them compatible with Decentraland and best practices.
See Set entity position for information on how you can configure a 3D model in a Decentraland scene to set its position, scale, etc.
Keep in mind that all models, their shaders and their textures must be within the parameters of the scene limitations.
Supported 3D model formats #
All 3D models in Decentraland must be in glTF format. glTF (GL Transmission Format) is an open project by Khronos providing a common, extensible format for 3D assets that is both efficient and highly interoperable with modern web technologies.
glTF models can have either a .gltf or a .glb extension. glTF files are human-readable, you can open one in a text editor and read it like a JSON file. This is useful, for example, to verify that animations are properly attached and to check for their names. glb files are binary, so they’re not readable but they are considerably smaller in size, which is good for the scene’s performance.
We recommend using .gltf while you’re working on a scene, but then switching to .glb when uploading it.
The following aspects of a 3D model can either be embedded in a glTF file or referenced externally:
- Textures can either be embedded or referenced from an external image file.
- Binary data about geometry, animations, and other buffer-related aspects of the model can either be embedded or referenced from an external .bin file.
📔 Note: Animations must be embedded inside the glTF file to use in Decentraland.
Export to glTF from Blender #
When exporting 3D models that include multiple animations, make sure that all animations are embedded in the model. To do this, open the NLA editor and click Stash to add each animation to the model.
We recommend using the following export settings when exporting models with animations:
Export to glTF from 3D Studio Max #
3D Studio Max doesn’t support exporting to glTF by default, but you can install a plugin to enable it.
- Download the plugin from this link.
- Install the plugin by following these instructions.
- Export glTF files using the plugin by following these instructions.
Export to glTF from Maya #
Maya doesn’t support exporting to glTF by default, but you can install a plugin to enable it.
- Install the plugin by following these instructions.
- Export glTF files using the plugin by following these instructions.
📔 Note: As an alternative, you can try this other plugin too.
Export to glTF from Unity #
Unity doesn’t support exporting to glTF by default, but you can install a plugin to enable it.
Download the plugin from this link.
📔 Note: As an alternative, you can try this other plugin too.
Export to glTF from SketchUp #
SketchUp doesn’t support exporting to glTF by default, but you can install a plugin to enable it.
Download the plugin from this link.
Preview a glTF model #
A quick and easy way to preview the contents of a glTF model before importing it into a scene is to use the Babylon.js Sandbox. Just drag and drop the glTF file (and its .bin file if applicable) into the canvas to view the model.
In the sandbox you can also view the animations that are embedded in the model, select which to display by picking it out of a dropdown menu.
Why we use glTF #
Compared to the older OBJ format, which supports only vertices, normals, texture coordinates, and basic materials, glTF provides a more powerful set of features that includes:
- Hierarchical objects
- Skeletal structure and animation
- More robust materials and shaders
- Scene information (light sources, cameras)
Compared to COLLADA, the supported features are very similar. However, because glTF focuses on providing a “transmission format” rather than an editor format, it is more interoperable with web technologies.
Consider this analogy: the .PSD (Adobe Photoshop) format is helpful for editing 2D images, but images must then be converted to .JPG for use on the web. In the same way, COLLADA may be used to edit a 3D asset, but glTF is a simpler way of transmitting it while rendering the same result.
Convert fbx into glTF #
.fbx is a very popular standard for 3D models. It’s not supported by our engine, but you can easily export an .fbx model to .gltf format.
We recommend using these tools:
-
Facebook’s CLI tool: this is the most robust alternative, but requires using the command line.
-
Blackthread: This the most complete web based tool. Less robust than the CLI, but a lot easier to use.
- Modelconverter: Another easy-to-use web based tool.
Optimize a glTF #
The following tool offers some optimizations that will make 3D models lighter and faster to download for players in your scene.
Among other things, it converts .gltf format into .glb, which is binary and so occupies a lot less. It also places texture files outside the 3D model, which allows you to use the same texture on multiple models.
📔 Note: .glb format by default always has textures embedded in the file. The engine can’t recognize two embedded textures as the same, they need to be external files that share a same hash.
See also #
The following pages also cover topics related to 3D models for Decentraland: