Fractal landscapes explained

Mountains, coastlines and clouds share a surprising property: zoom in on them and they look much the same. That self-similarity is what makes them fractals, and it is also a recipe. Add random detail at every scale, each scale a fixed fraction weaker than the last, and a computer grows landscapes that pass for real ones.

A fractal landscape: green mountains with snowy peaks around a fjord and a lake, under a blue sky with clouds
A fractal landscape: green mountains with snowy peaks around a fjord and a lake, under a blue sky with clouds

Mountains are fractals

Photograph a rock up close and a mountain from far away, and without a scale it is hard to tell them apart. Benoît Mandelbrot put this observation at the centre of his book The Fractal Geometry of Nature (1982): coastlines, mountain ranges and clouds are rough at every scale, and the roughness follows the same statistics from metres to kilometres. Such shapes are called self-similar, or self-affine when the vertical and horizontal directions scale differently.

Random detail at every scale

The recipe for a fractal landscape follows directly. Lay down a few large random heights, add smaller random heights in between, then smaller ones again, each layer weaker by a fixed factor. If the factor is right, the result has the same statistics at every scale and looks like terrain. The idea needs nothing about geology, rivers or erosion, which is why it is so fast, and also why a purely fractal landscape has no real river valleys.

Midpoint displacement and diamond-square

In 1982 Alain Fournier, Don Fussell and Loren Carpenter described the fastest way to do it. Start with a square of corner heights. Set its centre to the average of the corners plus a random offset (the diamond step), then each edge midpoint to the average of its neighbours plus an offset (the square step). The square is now four squares half the size: repeat with offsets 2^H times smaller. A grid of 2ᵏ points per side takes k rounds. The method is quick, but faint creases can remain along the first lines it draws.

Fractional Brownian motion and noise octaves

The mathematics behind it is fractional Brownian motion, introduced by Mandelbrot and John Van Ness in 1968: a random surface whose height differences over a distance d have a typical size proportional to d^H. Graphics programs build it from octaves of smooth noise, such as Ken Perlin's gradient noise of 1985. Each octave has twice the frequency and 2^−H times the amplitude of the one before; eight or nine octaves span the scales from a continent to a pixel. Folding each octave at zero gives ridged noise, with sharp crests like weathered rock.

The Hurst exponent and fractal dimension

The exponent H is named after Harold Edwin Hurst, a hydrologist who found it in the floods of the Nile. For a landscape it measures smoothness: H close to 1 gives rolling hills, H close to 0 a jagged chaos of spikes. The surface has fractal dimension 3 − H, and a horizontal slice through it, such as a coastline at sea level, has dimension 2 − H. Measured landscapes mostly fall between H = 0.7 and 0.8, so their dimension lies around 2.2 to 2.3.

Coastlines and the paradox of their length

Flood a fractal landscape and its coastline is a fractal curve. Measure it with a long ruler and the bays are skipped; a shorter ruler follows them and finds a longer coast. Lewis Fry Richardson noticed that published lengths of the same border differ widely for this reason, and Mandelbrot asked in 1967 how long the coast of Britain is. In the generator, the same island has a longer coastline at 512 × 512 than at 128 × 128.

From Star Trek to games

Loren Carpenter's short film Vol Libre (1980) flew over fractal mountains, and his subdivided terrain made the Genesis planet sequence in Star Trek II: The Wrath of Khan (1982), one of the first fully computer-generated scenes in a feature film. Since then fractal terrain has become a standard tool of films, flight simulators and games, usually as the first step before erosion, rivers and vegetation are added.

Frequently asked questions

Why do fractal landscapes look so realistic?

Because real terrain is close to fractal itself: uplift, erosion and weathering act at all scales and leave roughness with similar statistics everywhere. A random fractal with the right Hurst exponent reproduces those statistics, so the eye accepts it, even though nothing in it was shaped by water.

What is the difference between midpoint displacement and Perlin noise?

Midpoint displacement subdivides a grid and adds random offsets as it goes; it is fast but tied to its grid. Perlin noise is a smooth random function defined everywhere, and fractal noise adds several copies of it at doubling frequencies. Both produce fractional Brownian motion with a chosen Hurst exponent.

What fractal dimension do real mountains have?

Measurements usually give a surface dimension of about 2.2 to 2.3, so a Hurst exponent around 0.7 to 0.8. Young, steep mountains are rougher, old worn ranges smoother. Coastlines range from about 1.05 for smooth ones to 1.25 for the west coast of Britain and more for very rugged ones.

Why do the islands change at a higher detail?

The overall shape stays, but the generator adds finer levels of random detail. New bays, headlands and small islands appear along the coast, so the coastline gets longer and the number of islands may rise, just as the coastline paradox predicts.

Who invented fractal landscapes?

Benoît Mandelbrot and Richard Voss made the first images of fractal mountains and planets at IBM in the late 1970s and early 1980s. Alain Fournier, Don Fussell and Loren Carpenter published midpoint displacement in 1982, and Ken Perlin's noise of 1985 became the basis of most terrain generators since.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Open the fractal landscape generator