Lab · hands-on
Perlin noise and terrain live
2D Perlin noise → a heightmap colored as terrain. Turn frequency, octaves, lacunarity and persistence — and watch mountains and fine detail emerge out of smooth hills. This is fBm live: a sum of noise octaves with rising frequency and falling amplitude.
How to use this
Start with 1 octave — you get smooth "blobs" (a single noise frequency). Add octaves: each one lays finer, weaker noise on top → ridges and ripples appear (Minecraft's fractal terrain). Frequency — how coarse the base shapes are; lacunarity — how much the frequency grows per octave (usually 2); persistence — how much the amplitude drops (usually 0.5; higher → more "noisy/ragged"). Seed — a different world out of the same formula.
water
sand
grass
forest
rock
snow
Try this: set octaves=1 and add them back one at a time — you'll see finer and finer detail settle on top of the large shapes. That is exactly
Σ pⁱ·noise(lⁱx): the low octaves are mountains, the high ones are rocks and ripples.What to notice
Octaves = fractal detail
One octave gives only smooth hills at a single scale (smooth, "empty"). Every octave you add lays on noise at twice (lacunarity) the frequency and half (persistence) the amplitude — smaller-scale detail appears without disturbing the large shapes. Real terrain works the same way: mountains, ridges on them, rocks on those. Normalizing by the sum of amplitudes holds the contrast, so the picture doesn't wash out as octaves pile up.
Persistence changes the landscape's character
Low persistence (~0.3) → the high octaves barely register: smooth, "sanded down" terrain (gentle hills). High (~0.7) → the fine octaves are strong: ragged, rough, angry landscape (cliffs, drops). One knob covers the whole range, from soft dunes to sharp peaks. Lacunarity acts more subtly: how fast the detail frequency grows between octaves.
The world isn't stored — it's computed
All of this terrain is not megabytes of tiles but a function of coordinates and a seed:
height(x,y). Change the seed and you get another world instantly, with nothing stored. That is "store the function, not the output" from the lesson on hardware: it's how Minecraft/No Man's Sky fit "infinite" worlds into a tiny seed. And it's deterministic: the same seed+coordinates → the same patch of world on any device.