3D models have a mesh composed of triangular faces. These faces meet each other on edges (the lines along which they touch) and vertices (the points where their corners join).
Scene limits #
All 3D models in your scene must fit within the limits of its parcels. If they extend beyond these limits when running a preview, the meshes will be marked in red and bounding boxes will be highlighted in white.
For performance reasons, Decentraland checks the positions of the bounding boxes around meshes (not the vertices in the meshes themselves) to verify that they are within the scene’s limits.
If you have a model that has all of its vertices neatly inside the scene area, but that has large bounding boxes that are mostly empty and extend beyond the scene limits, the entire model will be marked as outside the scene limits.
To avoid this problem, you can clean up your 3D models to reset positions and rotations of meshes so that bounding boxes don’t extend beyond the meshes they wrap.
Smooth geometries #
You can configure a mesh to be smooth. This tells the engine to render its shape as if there was an infinite number of intermediate faces rounding it off. This setting can greatly help you reduce the number of triangles needed to make a shape appear to be rounded.
The image below shows two identical models with the same materials. They differ in that the one on the right has most of its geometry set to smooth.
Note how you can see distinct faces on all of the cylindrical shapes of the model on the left, but not on the model on the right.
This setting can be configured separately over individual faces, edges and vertices of a model. One same model could have some of its faces or edges set to smooth and others to sharp
Bounding boxes #
Every mesh has a bounding box, that surrounds the limits of the shape. Keep in mind that the bounding boxes of all 3D models in a Decentraland scene must fit inside the scene limits, see position entities for more details.
To make a 3D model more usable inside decentraland, make sure that its bounding boxes don’t extend beyond the model more than necessary.
For example, be cautious when rotating a sub-mesh near the border of your model. Since bounding boxes are cubes, even if the mesh is round, the corners of its bounding box might end up sticking out after rotating it 45°.
We recommend that you bake the rotation and scale of every mesh in the model, to make sure that there are no unwanted bounding boxes extending beyond the size they need to have.
Best practices for geometries #
- Be mindful of how many faces you add to your 3D models, as more faces make its rendering more demanding. See scene limitations for the limits imposed by a scene.
- Make sure there are no hidden faces that can’t be seen but that add to the triangle count.
- For shapes that should have rounded sides, set them to be smooth rather than adding additional faces.
- Make sure the normals of all faces are facing outwards instead of inwards. If there are faces in your model that seem not to be there when you render it, this is most likely the cause.
- Bake the rotation and scale of your meshes, so that their bounding boxes don’t extend out unnecessarily.