Models
A model is a mesh and its materials
Section titled “A model is a mesh and its materials”A modelmodel: A 3D object the game draws: a mesh, the materials on its parts, and simpler versions of itself for far away. is anything the game draws in 3D: a crate, a car, a ball, a character’s jacket. It’s two files working together:
- The mesh: the shape itself, as triangles, plus a skeleton if it bends. You make meshes in a 3D program.
- The model: a small file that names the mesh, says which material goes on each part of it, and when to swap to simpler versions as it gets further away.
Each one uses the ones to its right.
- Levela model componentdraws it here
- Modelcrate.
model - Meshcrate.
gr2. the shapeimport - Materialcrate_
wood. one per slotmaterial_ instance
Parts, or slots
Section titled “Parts, or slots”A mesh is split into slots, one per material: a car has one for its paint, one for its glass, one for its tyres. The model binds a material to each slot by name. So recolouring a car’s paint doesn’t touch its glass: they’re different slots with different materials.
A slot with no material draws untextured, which is the first thing to check when something you made shows up grey or checkered.
Levels of detail
Section titled “Levels of detail”Far away, nobody can tell a thousand-triangle crate from a hundred-triangle one, so models carry several versions of their mesh, called levels of detail, and the game picks one by how big the model looks on screen. When something pops as you walk away from it, that’s the switch.
A model also stores a bounding sphere, the size of the space it fills. The game uses it to decide when a model is on screen at all. It’s worked out from the mesh when a model is built; one that’s too small makes a model vanish before it’s out of view.
Where models come from
Section titled “Where models come from”| You want | Do |
|---|---|
| A shipped model somewhere new | Drag it into a level. Nothing to make. |
| A shipped model, but a different colour | Change its material or textures. See Materials and textures. |
| Your own model | Build it in a 3D program, export a GLB, and import it. See Importing. |
| A shipped model, reshaped | Replace its mesh with your own GLB, keeping everything that uses it. |
Before you model
Section titled “Before you model”- Model at game size. One unit is a centimetre, Z is up, and a character is about 154 units tall. Nothing is converted on import. See Space and transforms.
- Don’t scale the object in your 3D program. Apply the scale to the mesh instead. A scale left on the object can be silently dropped on the way in, and the model arrives the wrong size.
- Give it a UV map, even if you don’t plan to texture it. Every model needs one.
- Name your materials the way you want the slots named. Each material in your GLB becomes one slot.
For programmers
A model is two files: a .gr2.import (Granny geometry and rig, with one GPU buffer per draw call) and a .model
sidecar that binds a material instance per slot and sets the LOD screen-size thresholds. Slots bind by name. An
unbound slot falls back to a sibling <model>_materials/<slot>.material_instance if one exists, else draws
untextured. Units are centimetres, Z-up, and GLB import applies no conversion.
Where to go next
Section titled “Where to go next”Materials and textures: how a surface gets its look.