01 TERRAIN/
PROCEDURAL TERRAIN
Procedural terrain computing heights, erosion and materials entirely on the GPU.

01_terrain/readme.md
Approach
The heightfield is never stored. Every pixel raymarches a stack of fractal Brownian motion octaves, with the ray step scaled by the local slope so steep ridges stay crisp while flat valleys are crossed in a handful of samples. A domain-warped ridged-noise layer is mixed in above the snow line to suggest wind-carved crests.
Techniques
- Analytic derivatives — each octave returns its gradient alongside its value, so normals come for free and the octave weights can be damped on steep slopes, a cheap stand-in for hydraulic erosion.
- Material blending — rock, scree and snow are chosen from height, slope and a low-frequency “weather” field rather than hand-painted masks.
- Sun disc and haze — a single directional light, height fog and a soft sun disc keep the frame readable once the dither pass reduces it to two tones.
What to look at
Move the pointer across the frame: it nudges the sun azimuth. Watch how the erosion streaks follow the gradient and how the ordered dither keeps the silhouette legible even at a few hundred pixels wide.