TechniquesHeightfield chunks
Ground in square chunks that stream round the viewer, from a game’s own world.
What it costs a frame
- GPU
- 0.69 ms
- CPU, median
- 0.92 ms
- CPU, 95th pct
- 1.30 ms
- Draw calls
- 64
- Weight
- Moderate
Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 0.51–0.98, CPU 0.53–0.92 ms). What ran: Measured flying by itself at 14 m/s over the endless landscape, 38 m up, with the default rings (1 m within 96 m, 2 m within 224 m, 4 m within 480 m: about 210 chunks shown, about 60 drawn after culling). New chunks are made from the height formula and built, nearest first, inside a 2 ms allowance; most frames build none and a few build one or two. The levels view is off. Phones: tiers are being measured next.
| Machine | GPU ms | CPU ms | CPU p95 |
|---|---|---|---|
| RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool | 0.69 | 0.92 | 1.30 |
| apple · Apple A19 Proin a browser tab · 16 November 2026 | 4.94 | 1.54 | 2.90 |
| Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026 | 4.26 | 1.71 | 4.30 |
Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.
What it needs
- Renders with
- WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
- Your browser
- Runs hereNo WebGPU needed
- Depends on
- three.js 0.187.0No other packages
What it’s for
- An open world or a big level whose ground streams round the player
- A terrain editor that sculpts across chunk borders, with undo
- A flight or drone view over endless procedural country
- A map or site model whose ground comes in tiles
- Streaming any grid of tiles in a frame allowance, nearest first
- Hiding seams between tiles of different detail
- Baking a height formula into tiles that agree at their edges
Pitfalls, in brief
- Store every border sample in both chunks (a corner in four) and write it to all of them on every edit.
- Sample a height formula on the world lattice, at whole-number sample indices times the spacing, not at a chunk’s origin plus an offset: then a border sample is the same number to the bit in both chunks.
- The resolution must be an odd number of samples (an even number of cells): 129 is 128 cells.
- Read normals and shade from the world’s heights, past the chunk’s own edge, not from the chunk alone.
- After an edit, reshape the neighbours whose normals and shade read the changed area (the shade reaches 12 m past a chunk), not only the chunks whose heights changed: their border lighting otherwise stays the old one.
9 more in brief
- Reshape every chunk a stroke reaches in the same frame.
- Skirts hide the cracks where a fine chunk meets a coarse one (the coarse edge cuts straight between its vertices, the fine one follows the ground).
- Give every ring a let-go distance past its take distance (32–64 m).
- Plan the rings again only after the viewer has moved some metres (8 here) or something changed.
- Keep each job small: a unit starts only while the allowance is open, so a frame overruns by one unit at most.
- One material and one mesh pool per resolution: a chunk coming into view must never compile anything.
- Where no chunk is made yet the world reads the formula; between samples it blends the samples round the point exactly as a made chunk does, so the ground does not move by a hair when the chunk is made.
- Let go of what was made from the formula: a world made from a formula without end grows by every chunk the focus ever passed (66 KB each at 129², some 12 MB a minute in the demo’s flight) unless chunks are forgotten when let go.
- Pointer picking marches the heights, not a physics ray: the colliders lag while the ground is being sculpted.
Where it comes from
From HaTac. Fully custom code.
Mark Jarzynski and Marc Olano, “Hash Functions for GPU Rendering” (JCGT, 2020): the PCG hash that fills the demo landscape’s table of random values
Thatcher Ulrich, “Rendering Massive Terrains using Chunked Level of Detail Control” (SIGGRAPH 2002 course notes): skirts hung from chunk edges to hide cracks between levels: the well-known method the source uses


