Sketch · 2026-08-10
Diamond-square, on a fractal heightmap.
Diamond-square is a fractal terrain generator from a 1982 paper by Fournier, Fussell and Carpenter. Start with a square, seed the four corners with heights, then refine by halving the grid over and over. Each pass smooths the field and then jitters it. The output reads as real terrain because self-similarity at every scale is what real terrain has.
One round
A round has two halves. For every open square, the square step averages the four corners and adds a random jitter. For every open diamond, the diamond step averages the four edge midpoints and adds the same size of jitter. After both halves, the grid holds twice as many samples along each axis, and the next round starts with a smaller jitter.
Roughness
The jitter shrinks by a factor of 2 to the power of minus H on every round, where H is the roughness exponent. A small H keeps the jitter large as the grid refines, so the surface stays craggy at every scale. A large H kills the jitter fast, so the coarse shape wins and fine detail flattens out. H tunes the fractal dimension of the result: values near 1 give something close to a real landscape.
The seam artefact
Diamond-square has a well-known flaw. The square step and the diamond step are not the same operation, and their variance profiles do not match. On a large enough map, faint horizontal and vertical seams appear along the grid lines from earlier rounds. Perlin noise and simplex noise avoid this by using a single smooth gradient function at every scale, which is why they replaced midpoint-displacement for most modern uses.
Sources
- Fournier, A., Fussell, D., and Carpenter, L. (1982). Computer Rendering of Stochastic Models. Communications of the ACM, 25(6), 371–384. The paper that introduced midpoint-displacement terrain and gave diamond-square its name.
- Miller, G. S. P. (1986). The Definition and Rendering of Terrain Maps. ACM SIGGRAPH Computer Graphics, 20(4), 39–48. Documents the seam artefact and proposes a smoothed variant.
- Mandelbrot, B. B. (1982). The Fractal Geometry of Nature. W. H. Freeman. Chapter on fractional Brownian surfaces frames why the roughness exponent H controls the visual character of the output.