Generate procedural terrain
site/media/lessons/scenes-batch.lesson.ts (4 steps) A mesh with a generator field gets its geometry from a registered geometry generator. The
terrain scene uses the built-in Terrain generator — a horizontal heightfield displaced by
a deterministic sum of sines.
-
Open the terrain scene. Load
examples/scenes/terrain.vscn.json.
The terrain scene. -
Enter play mode — the terrain generator builds a heightfield. The Terrain generator produces an XZ plane displaced in +Y.
A generated heightfield. -
A procedural sum-of-sines heightfield renders. Params
width,depth,segments,amplitude, andfrequencyshape it; it’s deterministic (noMath.random), so it pairs cleanly with atrimeshcollider.
Deterministic terrain. -
Stop play mode. Press Stop (or
Escape).
Recap
New functionality
- Ran a scene using the Terrain generator
- Saw a procedural heightfield
New concepts & skills
- A mesh's generator field -> registered geometry generator
- Terrain is a deterministic sum-of-sines heightfield
- Params: width/depth/segments/amplitude/frequency; pairs with a trimesh collider
Next lesson → Manual: Instancing, terrain & splines
On Your Own!
Extend what you built:
- Raise amplitude in generatorParams for taller hills
- Increase segments for finer detail
- Add a trimesh collider so physics matches the surface