08 What Three.js writes for you
Instancing: ten thousand in one draw call
The same boxes, drawn as separate meshes and as one InstancedMesh.
2100
Exercise
Drag the underlined numbers left and rightDrag numbers, or edit the code
const mesh = new THREE.InstancedMesh( geometry, material, );for (let i = 0; i < count; i++) { matrix.setPosition(x, 0, z); mesh.setMatrixAt(i, matrix);}scene.add(mesh); // 1 draw call
draw calls· triangles
draw callEach time the CPU asks the GPU to draw a batch of triangles. More calls, busier CPU.JS side
Every Mesh is one draw call; an InstancedMesh draws thousands of copies in a single call.
Try it
- With “Separate meshes”, raise the count and watch draw calls grow
- Switch to InstancedMesh: draw calls drop to 1