Diamond-Square Algorithm for Creating Landscapes

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

This Demonstration implements the diamond-square algorithm for creating landscapes. You can choose various options to determine the color, smoothness and terrain.


Use the "color" control to set the color sequence and height values at every point to create a unique color gradient.

Use the "divisions" control to subdivide the surface.

The "terrain" control specifies values for range and roughness, both of which are used to define the height value at various points.

The "smoothing" control sets how many points around a given point are used in creating an average height value. This is used to generate a new height function that smooths the resulting graphic.


Contributed by: Mary Clarke and Steven Wilkinson (August 2020)
Open content licensed under CC BY-NC-SA



This implementation uses the ideas presented in [1–5].


[1] P. Martz. "Generating Random Fractal Terrain." (Aug 11, 2020) web.archive.org/web/20060420054134/http://www.gameprogrammer.com/fractal.html#diamond.

[2] "Terrain Tutorial." Lighthouse3d.com. (Aug 11, 2020) www.lighthouse3d.com/opengl/terrain/index.php?mpd2.

[3] S. Booth. "All about Xmountains." (Aug 11, 2020) spbooth.github.io/xmountains/about_xmountains.html.

[4] A. Fournier, D. Fussell and L. Carpenter, "Computer Rendering of Stochastic Models," Communications of the ACM, 25(6), 1982 pp. 371–384. doi:10.1145/358523.358553.

[5] J. P. Lewis, "Generalized Stochastic Subdivision," ACM Transactions on Graphics, 6(3), 1987 pp. 167–190. doi:10.1145/35068.35069.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.