Diamond-Square Algorithm for Creating Landscapes

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.



  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.