Skip to content

Instancing, terrain & splines

Three geometry techniques handle large or procedural content. Instancing consumes native Three.js matrices, terrain uses ordinary image/model assets, and splines remain source-authored curves. Keep repeatable generation in project scripts so the same inputs reproduce the same assets.

Instancing draws many copies in one call; terrain is a procedural heightfield; splines are CatmullRom curves
Instancing, terrain, and splines.

Create a THREE.InstancedMesh and apply ordinary THREE.Matrix4 transforms with setMatrixAt(). Keep procedural placement in TS/TSX; when placements must travel as an asset, bake glTF using the standard EXT_mesh_gpu_instancing extension instead of a vgai tuple file.

Terrain is ordinary project-owned data. Author a mesh in Blender and export GLB, or keep a grayscale PNG/TIFF/EXR heightmap plus an RGB(A) splatmap and decode them in project source. The copied-in terrain helper turns one height array into both a Three.js mesh and Rapier heightfield collider, keeping the visible and physical surfaces together.

Construct THREE.CatmullRomCurve3 directly from project-owned Vector3 control points. Its native closed, curveType, and tension options cover paths, camera rails, and procedural placement without another persisted schema.