Render thousands with instancing
site/media/lessons/scenes-batch.lesson.ts (4 steps) A mesh with an instancer field renders as a single THREE.InstancedMesh β one draw call
for many copies. The instanced-grid scene uses the built-in Grid instancer.
-
Open the instanced-grid scene. Load
examples/scenes/instanced-grid.vscn.json.
The instanced-grid scene. -
Enter play mode β the instancer renders the grid. The Grid instancer lays out a
countXΓcountZgrid (default 100 Γ 100 = 10,000 instances) on the XZ plane.
A grid of instances. -
Thousands of instances draw in a single InstancedMesh. One draw call covers the whole grid; optional
jitteruses a seeded LCG so the layout is deterministic across loads.
One InstancedMesh, many instances. -
Stop play mode. Press Stop (or
Escape).
Recap
New functionality
- Ran a scene using the Grid instancer
- Saw a large grid drawn in one call
New concepts & skills
- A mesh's instancer field -> one InstancedMesh
- The Grid instancer uses countX/countZ/spacing/jitter
- Jitter is a seeded LCG (deterministic, no Math.random)
Next lesson β Manual: Instancing, terrain & splines
On Your Own!
Extend what you built:
- Change countX/countZ in the scene's instancerParams
- Add jitter and reload β the layout is identical each time
- Register your own instancer that produces a circular layout