The live demo starts when it’s in view.Drag to turn both views · toggle the four terms · Compare stretching isolates slope views on checker tiles
Make the shape of bright ground readable: lengthen its normal’s tilt for lighting, distinguish lee and windward faces, and bake local horizon occlusion into hollows.
World-fixed projection planes in three rings, sixteen ways round, keep tiles close to their real size on steep faces without turning the texture with each pixel’s normal. Includes mask offsets and a pixel-footprint fade for small patterns. The demo compares identical dunes under the same camera and sun, with a checker view to isolate stretching against ordinary triplanar mapping.
What it costs a frame
GPU
0.32 ms
CPU
0.20 ms
02468101216.7 ms
GPU
0.32 ms
CPU, median
0.20 ms
CPU, 95th pct
0.32 ms
Draw calls
4
Weight
Light
Measured 19 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.32–0.32, CPU 0.18–0.23 ms). What ran: Two views of the same static 32 m heightfield, 128 × 128 cells at high quality. Left: plain triplanar. Right: relief normal, lee tone, baked vertex occlusion and world-fixed slope views. Procedural tiles, no texture fetches, no automatic camera motion. Occlusion bakes once at setup. Phones: tiers are being measured next.
How steadily it runs on RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · reference
Typical frame ?
3.17 ms
1% low ?
127 fps
Varies by ?
±0.99 ms
All metricsRTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900H · referenceHow long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.
Frames run back to back, each starting once the GPU has finished the last, so frame times show the work itself. They have a floor of about 4–5 ms from the browser’s own scheduling: GPU and CPU ms stay the measure of cost.
Frames
Median (p50) ?
3.17 ms
p95 ?
5.97 ms
p99 ?
7.15 ms
Slowest ?
9.79 ms
Mean ?
3.71 ms
Standard deviation ?
0.99 ms
1% low ?
127 fps
0.1% low ?
102 fps
Hitches ?
9 of 600
Over budget ?
0 of 600
Main thread
Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.0 / 0.5 / 0.5 ms
Input
No input during this run.
Memory
JavaScript heap ?
44.9 → 47.5 MB
Growth ?
+2.61 MB
Browser
JavaScript a frame ?
0.01 ms
All tasks a frame ?
0.41 ms
Layout / style ?
0.00 / 0.00 ms
Main thread busy ?
11%
Garbage collection
Collections ?
3 (3 minor, 0 major)
Pauses ?
1.3 ms in all, longest 0.5
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
With an agent
install("ground-relief")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it up
What it’s for
Bright sand or snow whose height differences disappear under front lighting
Terrain tiles stretched into streaks on banks and cliffs
Local sky occlusion for heightfield chunks, updated after edits or neighbour arrival
Stable procedural terrain patterns that fade before they shimmer
Pitfalls, in brief
Use the geometric normal: groundViews and reliefNormal take a normalized Y-up mesh normal (normalWorldGeometry), not the texture-perturbed normalWorld.
Keep projections fixed in the world: project world position onto viewFrame’s axes.
A world normal is already transformed: convert reliefNormal’s result to view space with cameraViewMatrix and w = 0 for material.normalNode. transformNormalToView expects an object-space normal and would transform the object twice.
Horizon samples cross chunk edges: heightAt must answer for a halo of ceil(reach / step) * step outside the requested region.
Grid and image rows run opposite ways: reliefOcclusion rows go from south to north (+z); writeOcclusion writes north-to-south rows into RGBA alpha, with base measured in bytes.
4 more in brief
Take texture derivatives before branches: groundViews selects up to four fixed planes.
Projection weights can ghost between views: the source terrain sharpens shares by each tile’s height (VIEWS.sharp).
Relief is a lighting treatment: it cannot repair a coarse mesh, a jagged silhouette or bilinear heightfield saddles.
No measurement yet: hollow work scales with grid points and reach / step; bake on edits, never every frame.
9 pitfalls in full, the hook-up guide, the module source and its tests come with the part.
Where it comes from
From HaTac. Adapted from published work, named below.
Hannes Andersson: The source game’s relief lighting, horizon occlusion and fixed projection views; the rendering notes explain the front-light and stretching failures they address.