Home  

Random  

Nearby  



Log in  



Settings  



Donate  



About Wikipedia  

Disclaimers  



Wikipedia





Diamond-square algorithm





Article  

Talk  



Language  

Watch  

Edit  





The diamond-square algorithm is a method for generating heightmaps for computer graphics. It is a slightly better algorithm than the three-dimensional implementation of the midpoint displacement algorithm, which produces two-dimensional landscapes. It is also known as the random midpoint displacement fractal, the cloud fractal or the plasma fractal, because of the plasma effect produced when applied.

Plasma fractal
Animated plasma fractal with color cycling

The idea was first introduced by Fournier, Fussell and CarpenteratSIGGRAPH in 1982.[1]

The diamond-square algorithm starts with a two-dimensional grid, then randomly generates terrain height from four seed values arranged in a grid of points so that the entire plane is covered in squares.

Description

edit

The diamond-square algorithm begins with a two-dimensional square array of width and height 2n + 1. The four corner points of the array must first be set to initial values. The diamond and square steps are then performed alternately until all array values have been set.

Each random value is multiplied by a scale constant, which decreases with each iteration by a factor of 2−h, where h is a value between 0.0 and 1.0 (lower values produce rougher terrain).[2]

During the square steps, points located on the edges of the array will have only three adjacent values set, rather than four. There are a number of ways to handle this complication - the simplest being to take the average of just the three adjacent values. Another option is to 'wrap around', taking the fourth value from the other side of the array. When used with consistent initial corner values, this method also allows generated fractals to be stitched together without discontinuities.

Visualization

edit

The image below shows the steps involved in running the diamond-square algorithm on a 5 × 5 array.

 

Applications

edit

This algorithm can be used to generate realistic-looking landscapes, and different implementations are used in computer graphics software such as Terragen. It is also applicable as a common component in procedural textures.

Artifacts and extensions

edit

The diamond-square algorithm was analyzed by Gavin S. P. Miller in SIGGRAPH 1986[3] who described it as flawed because the algorithm produces noticeable vertical and horizontal "creases" due to the most significant perturbation taking place in a rectangular grid. The grid artifacts were addressed in a generalized algorithm introduced by J.P. Lewis.[4] In this variant the weights on the neighboring points are obtained by solving a small linear system motivated by estimation theory, rather than being fixed. The Lewis algorithm also allows the synthesis of non-fractal heightmaps such as rolling hills or ocean waves. Similar results can be efficiently obtained with Fourier synthesis,[5] although the possibility of adaptive refinement is lost. The diamond-square algorithm and its refinements are reviewed in Peitgen and Saupe's book "The Science of Fractal Images".[5]

References

edit
  1. ^ Fournier, Alain; Fussell, Don; Carpenter, Loren (June 1982). "Computer rendering of stochastic models". Communications of the ACM. 25 (6): 371–384. doi:10.1145/358523.358553. ISSN 0001-0782.
  • ^ "Generating Random Fractal Terrain". 2006-04-20. Archived from the original on 2006-04-20. Retrieved 2022-12-13.
  • ^ Miller, Gavin S. P. (August 1986). "The definition and rendering of terrain maps". ACM SIGGRAPH Computer Graphics. 20 (4): 39–48. doi:10.1145/15886.15890.
  • ^ Lewis, J. P. (1 July 1987). "Generalized stochastic subdivision". ACM Transactions on Graphics. 6 (3): 167–190. CiteSeerX 10.1.1.21.3719. doi:10.1145/35068.35069. S2CID 14994949.
  • ^ a b Peitgen, Heinz-Otto, Dietmar Saupe (1988). The Science of Fractal Images. New York: Springer-Verlag. ISBN 978-0-387-96608-3.{{cite book}}: CS1 maint: multiple names: authors list (link)
  • edit

    Retrieved from "https://en.wikipedia.org/w/index.php?title=Diamond-square_algorithm&oldid=1181050351"
     



    Last edited on 20 October 2023, at 15:06  





    Languages

     


    العربية
    Български
    Deutsch
    Ελληνικά
    Français
    Русский
     

    Wikipedia


    This page was last edited on 20 October 2023, at 15:06 (UTC).

    Content is available under CC BY-SA 4.0 unless otherwise noted.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Terms of Use

    Desktop