Interactive demo
Diamond-Square Algorithm
The diamond-square algorithm builds a fractal landscape without any noise function: it starts with four corners and keeps filling in midpoints, each the average of its neighbors plus a random offset that shrinks with every level.
Press Play to build the map again from its four corners, or drag the Step slider. Coral points come from a diamond step, amber points from a square step; the lines lead to the points they average.
Controls
Square step of level 7 · grid spacing 1
Display
Legend
- Points set in earlier steps
- Diamond step: center of a square
- Square step: center of a diamond (edge midpoint)
Noise types compared
| Noise | Output | Built from | Work per sample | Smooth |
|---|---|---|---|---|
| Value Noise | Scalar field | Random values on a grid | 4 grid points | Yes |
| Perlin Noise | Scalar field | Random gradients on a grid | 4 grid points | Yes |
| Simplex Noise | Scalar field | Gradients on a triangle grid | 3 corners | Yes |
| Worley Noise | Scalar field | Random feature points | 9 to 25 cells | No |
| Blue Noise | Point set | Random candidates around existing points | Up to 30 tries per point | – |
| Fractal Noise | Scalar field | Octaves of a base noise | 1 base noise per octave | Yes |
| Diamond-Square this page | Heightmap | Displaced midpoints of a grid | 4 neighbors per point | No |
| Colors of Noise | Signal or image | White noise filtered by frequency | 1 FFT for all samples | – |
| Domain Warping | Scalar field | Fractal noise at warped positions | Up to 5 fractal noises | Yes |
| Curl Noise | Vector field | Derivatives of a noise field | 4 noise samples | Yes |
| Noise Terrain Generator | Heightmap | Stacked noise layers | Layers × octaves | – |
1. Diamond step
The center of every square gets the average of its four corners plus a random offset. Together with the corners, the new centers form a pattern of diamonds, squares turned by 45°.
2. Square step
The center of every diamond, the midpoint of an edge, gets the average of the diamond's four corners, again plus an offset. At the border only three exist. Afterwards the points form squares again, with twice as many per side.
3. Roughness
After every level, the offsets are multiplied by the roughness. With 0.5 the detail shrinks as fast as the grid, like fractal noise with a gain of 0.5; higher values give jagged mountains. Straight creases along the first grid lines are a known artifact of the algorithm.
Credits
- The algorithm was published in Computer rendering of stochastic models by Alain Fournier, Don Fussell and Loren Carpenter (Communications of the ACM, 1982).