1000 shapes: meshes, instances, merged, batched
Seeded placement, so every run is the same. All four versions draw the same 80,000 triangles.
Each mesh costs one draw call. When many objects share a shape and a material, InstancedMesh, BatchedMesh or merged geometry send them in one call. The counts prove it.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 4 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
A scene has 300 identical lamp posts and 300 trees from 3 different models, all with one material each. Name the draw-call count if you use plain meshes, and the best arrangement.
mergeGeometries returns null. Give two likely causes.
Explain it without notes
When would you choose BatchedMesh over InstancedMesh, and what does it cost?
Why does a merged mesh draw the same number of triangles as 1000 meshes, but cost less?
Console
Nothing logged yet.Expected console output
1000 meshes 1000 draw calls 80000 triangles | geometries so far: 1
InstancedMesh 1 draw calls 80000 triangles | geometries so far: 1
merged geometry 1 draw calls 80000 triangles | geometries so far: 2
BatchedMesh 1 draw calls 80000 triangles | geometries so far: 3