What it does
The landscape is sampled on one stable world lattice. Tiles of tileSize world units are built around the camera out
to radius tiles, nearest missing tile first, at most buildsPerTick each simulation tick. Their meshes and small
colour-atlas frames are reused as the window moves, so the number of meshes is set by the radius, (2 * radius + 1)²
at most, rather than by how far the player has gone. Source heightfields sit in a least-recently-used cache of
cacheTiles.
heightAt is triangle-exact and answers anywhere without building a tile, and normalAt gives the slope from
neighbouring samples, so a walking camera, a vehicle or a low-flying aircraft can read the ground at any distance.
Far tiles drop to coarser detail, and their edges meet full-resolution neighbours on identical boundary vertices, so
there are no cracks between levels and no skirts to hide them.
Edits use the raise, flatten, road and valley operations of terrain-3d. Only the samples you changed are
kept, and they survive eviction: carve a road, travel away, come back, and it is still there. save and load
persist those samples. Underneath, the exported TerrainTileStore does the generation, caching, queries and
authoring with no rendering at all.
Features
- Camera-centred tiles — a radius of one to six tiles around the camera, with the mesh count fixed by it.
- Bounded work — one to eight tile builds or detail changes per tick, nearest first, and
pendingreports the queue. - Bounded memory — a cache of 1 to 1,024 source tiles, and mesh and atlas slots reused rather than allocated.
- Ground queries anywhere —
heightAtandnormalAtwithout loading a tile, on one lattice that runs through negative coordinates too. - Persistent sparse edits — raise, flatten, road and valley, validated and committed as a whole, kept through
eviction, with
saveandload. - Crack-free distance detail — coarse tile interiors join full-resolution edges, with matching colour texels at the boundaries.
- Your own landform — a seed, amplitude and feature size for the built-in generator, or a pure
heightfunction. - Resource readouts —
tiles,cachedTiles,trianglesandpending, on WebGPU and WebGL2 alike.
Good for
- Flight games over hills that continue wherever the player turns.
- Exploration and expedition games that cross kilometres of country on foot or by vehicle.
- Off-road driving across open land, with
heightAtandnormalAtfor the wheels anywhere on the map. - Travel and survival games where the world is a seed and the player's roads and levelled camps must stay put.
- Tools and simulations that need ground heights far from the camera, through
TerrainTileStoreon its own.
Make it yours
The options are the tile's world width (tileSize, default 192), its detail (resolution, 16 to 256 quads a side,
default 64), the window (radius, default 3), the build budget (buildsPerTick, default 2), the cache
(cacheTiles, default 64), and the landform: seed, amplitude and featureSize, or your own height function.
The settings pull in different directions for different games. A fast flight game wants a wider radius and a bigger build budget, with fog drawn in to hide the loading edge. A walking expedition can use smaller, more detailed tiles in a tighter window, with its own height function for a hand-shaped valley and edits for the camps and tracks the player makes.
Works with
terrain-3d— for a finite authored scene, with biome painting, footprint placement, undo and redo, and smooth detail transitions.rig-fps— give its floor the streamed world'sheightAt, and the player walks the ground wherever they go.world-3dandrender-3d— the world it builds into and the renderer that draws it;procgensupplies its noise.
Good to know
- It is bounded tile paging, not a planet renderer: queries refuse coordinates beyond ±1,000 km, and rendering precision falls off towards that limit.
- Generation and colour baking run on the CPU under a tile-count budget, not on a worker; keep travel speed within it, since a teleport briefly shows the loading edge.
- Detail changes are discrete, without the morphing
terrain-3dhas. - Streaming does not page foliage, water, buildings or physics, there are no caves or overhangs, and region masks and
landform brushes belong to
terrain-3d. - An edit batch covers at most 262,144 candidate samples and authored data at most a million; restore a save with the same generator settings it was made with.






