Fractal landscapes are procedurally generated terrains that exhibit statistical self-similarity across scales—zooming in reveals the same degree of roughness as the full view. The most common algorithm is the diamond-square (midpoint displacement) method: starting with a flat grid, the center of each square is set to the average of its corners plus a random offset, and the midpoint of each edge is set similarly. Repeating this at successively finer scales, with the random offset scaled by a roughness parameter H, produces terrain indistinguishable in character from real mountain ranges.
The mathematical foundation is fractional Brownian motion (fBm), characterized by the Hurst exponent H ∈ (0,1). H = 0.5 gives ordinary Brownian motion (uncorrelated random walk); H > 0.5 produces persistent, smooth, gently rolling terrain; H < 0.5 gives anti-persistent, rough, jagged terrain. The fractal dimension D = 2 − H relates to the terrain's roughness: D = 2 is a smooth surface, D = 3 is space-filling. Real mountain topography has H ≈ 0.7–0.8, and fBm with those parameters matches satellite elevation data statistically.
This simulator generates terrain in real time using the diamond-square algorithm, letting you tune the roughness parameter, initial seed, and color mapping (elevation-based, slope-based, or water filling). You can observe how varying H produces landscapes ranging from jagged lunar highlands to smooth rolling plains, and how water filling (setting all points below a threshold to blue) reveals realistic coastlines and lake distributions.
What makes a landscape "fractal"?
A fractal landscape is self-similar across scales—statistical properties like roughness, number of peaks, and coastline complexity are the same whether you view 1 km or 1000 km of terrain. This means there is no single "natural scale" to the landscape; it looks similar at all zoom levels. Real mountain terrain closely matches this statistical self-similarity (though not exact), which is why fractal generation produces realistic-looking results. The box-counting dimension, a measure of how the pattern fills space as scale changes, quantifies this fractality.
How does the Hurst exponent H control terrain roughness?
The Hurst exponent H ∈ (0,1) controls the correlation structure of the height field. High H (near 1) means heights at nearby points are highly correlated—gentle, smooth terrain with gradual elevation changes. Low H (near 0) means nearby points are nearly uncorrelated—extremely jagged, rough terrain. At H = 0.5, the terrain is a standard random walk with no persistence. Geologically, erosion processes tend to produce H > 0.5 because they smooth terrain over time, creating the persistent, rolling landscapes typical of old, heavily eroded mountain belts.
How does the diamond-square algorithm work step by step?
The algorithm starts with a 2ⁿ+1 × 2ⁿ+1 grid with only corner values set. In the diamond step, the center of each square is set to the average of its four corners plus a random offset scaled by the current roughness. In the square step, the midpoint of each edge is set to the average of its adjacent grid points plus a random offset. Each level of recursion halves the grid spacing and scales the random offset by 2^(-H), controlling how rapidly randomness decreases with scale. After n levels, every grid point has been assigned a height value.
Nature itself generates many landforms through processes (tectonic uplift, erosion, glaciation, weathering) that produce statistical self-similarity. River networks, coastlines, mountain ridgelines, and valley systems all exhibit fractal properties because the physical processes shaping them operate similarly across a wide range of scales. Since fractal generation mimics these statistical properties, the result looks visually indistinguishable from real terrain at the appropriate Hurst exponent, even though no actual physical process was simulated.
Fractals appear throughout nature: coastlines (Richardson paradox—measured length increases with smaller measuring units), river networks (branching self-similar trees), cloud outlines (fractal boundary), lightning bolts (dielectric breakdown following fractal paths), tree branching patterns, snowflake crystal arms (Koch-curve-like at microscopic scales), coral reef surfaces, and the distribution of craters on planetary surfaces. The Mandelbrot and Julia sets are mathematical fractals with infinite complexity. In biology, fractal branching maximizes surface area in lungs, blood vessel networks, and intestinal villi.