Reach for the built-in random() to make a mountain range and you get static:
every height independent of its neighbour, a jagged mess no terrain ever looks like. Real
worlds are smoothly irregular — rolling hills, drifting clouds, weathered rock. The
tool that manufactures that organic randomness is procedural noise, and it
is the perfect finale for this branch: it is built from
Step 1 — plain random is white noise. Calling
Step 2 — pin random values to a lattice. The key idea (this is
value noise, and its cousin Perlin/gradient noise) is to be
random only at the integer lattice points. Assign each whole-number coordinate
Step 3 — interpolate smoothly between lattice points. For a point
Because
Step 4 — one octave is too plain; stack several. A single noise curve has features at one scale only — gentle, but bland. Nature has big shapes and fine detail. So we add copies of the same noise at different scales, called octaves. Each successive octave doubles the frequency (squeezes the wiggles closer) and halves the amplitude (shrinks their height):
Octave
Step 5 — it's deterministic, so it's repeatable. Every value traces back to
the seeded lattice values, and the smoothstep + octave sum are fixed formulas. So the
same input
The same noise function, sampled differently, builds an astonishing range of a game's natural content:
A seeded 1-D noise curve. With 1 octave it's a single smooth wave — organic but plain. Raise the octaves slider and watch finer, fainter detail pile onto the broad shape: that's the fractal sum, each layer at double the frequency and (by default) half the amplitude. The base frequency stretches or squeezes the whole pattern, and persistence tunes how quickly the higher octaves fade — drop it and the curve smooths out, raise it and the fine detail roughens up. It is seeded, so the shape is the same every time you load the page.
And that closes the branch. Look back at the chain you've built: vectors gave you positions and directions; transforms moved, rotated and scaled them; rotations (matrices and quaternions) turned things without tearing them; projection flattened the 3-D world onto a screen; raytracing fired rays back out to light it; collision kept the solids from passing through one another; and finally curves and noise gave you smooth motion and organic, infinite worlds. Each was a small idea — a dot product, a lerp, a derivative, a smoothstep — and stacked together they are, quite literally, a whole game world's worth of mathematics. Now go build one.