Diamond-square algorithm

Diamond-square algorithm
Plasma fractal

The diamond-square algorithm is a method for generating highly realistic 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.

The idea was first introduced by Fournier, Fussell and Carpenter at SIGGRAPH 1982[1]. It was later analyzed by Gavin S. P. Miller in SIGGRAPH 1986[2] who described it as flawed — the algorithm produces noticeable vertical and horizontal "creases" due to the most significant perturbation taking place in a rectangular grid.

The algorithm starts with a 2D 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.

Contents

Midpoint displacement algorithm

Example on first iteration
  • Assign a height value to each corner of the rectangle (image).
  • Divide the rectangle into 4 subrectangles, and let their height values be the mean values of the corners of the parent rectangle.
For example, the upper left sub-rectangle in

\begin{bmatrix}
0 & 2 \\
4 & 8\\
\end{bmatrix}
will have the height values 
\begin{bmatrix}
0 & (0+2)/2 \\
(0+4)/2 & (0+2+4+8)/4 \\
\end{bmatrix}
=
\begin{bmatrix}
0 & 1 \\
2 & 3.5\\
\end{bmatrix}
But when computing the middle height, one should add a small error that depends on the size of the rectangle (the standard is to let the error be proportional to the size of the rectangle and some constant. The constant controls the "roughness" of the fractal; a bigger constant results in more valleys and mountains).
  • Iterate and subdivide each rectangle into smaller ones. Eventually, they will be too small to produce a noticeable difference. When this occurs, stop the iteration, and render the pixel with the mean of the height values.

Diamond-square algorithm

The difference from the above algorithm is an intermediate step that regards diamond-shaped squares as well. This reduces the squared-shaped artifacts in the landscape, since the diamonds are rotated 45 degrees relative to the squares.

Applications

This algorithm can be used to generate realistic-looking landscapes, and different implementations are used in computer graphics software such as Terragen.

References

  1. ^ Fournier, Alain; Fussell, Don; Carpenter, Loren (June 1982). "Computer rendering of stochastic models". Communications of the ACM 25 (6): 371–384. 
  2. ^ Miller, Gavin S. P. (August 1986). "The definition and rendering of terrain maps". ACM SIGGRAPH Computer Graphics 20 (4): 39–48. 

External links



Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Algorithm — Flow chart of an algorithm (Euclid s algorithm) for calculating the greatest common divisor (g.c.d.) of two numbers a and b in locations named A and B. The algorithm proceeds by successive subtractions in two loops: IF the test B ≤ A yields yes… …   Wikipedia

  • Square One (puzzle) — This article is about the puzzle. For the popular phrase, see Back to square one. The Square One, also known as Back to Square One and Cube 21, is a puzzle similar to the Rubik s Cube. Its distinguishing feature among the numerous Rubik s Cube… …   Wikipedia

  • List of mathematics articles (D) — NOTOC D D distribution D module D D Agostino s K squared test D Alembert Euler condition D Alembert operator D Alembert s formula D Alembert s paradox D Alembert s principle Dagger category Dagger compact category Dagger symmetric monoidal… …   Wikipedia

  • Fractal landscape — A fractal landscape is a surface generated using a stochastic algorithm designed to produce fractal behaviour which mimics the appearance of natural terrain. In other words, the result of the procedure is not a deterministic fractal surface, but… …   Wikipedia

  • Fractal — A fractal is generally a rough or fragmented geometric shape that can be split into parts, each of which is (at least approximately) a reduced size copy of the whole, [cite book last = Mandelbrot first = B.B. title = The Fractal Geometry of… …   Wikipedia

  • Combination puzzle — Part of a series on Puzzles …   Wikipedia

  • Mathematics and Physical Sciences — ▪ 2003 Introduction Mathematics       Mathematics in 2002 was marked by two discoveries in number theory. The first may have practical implications; the second satisfied a 150 year old curiosity.       Computer scientist Manindra Agrawal of the… …   Universalium

  • Rubik's Cube — Other names Magic Cube …   Wikipedia

  • List of Russian people — The Millennium of Russia monument in Veliky Novgorod, featuring the statues and reliefs of the most celebrated people in the first 1000 years of Russian history …   Wikipedia

  • Logarithm — The graph of the logarithm to base 2 crosses the x axis (horizontal axis) at 1 and passes through the points with coordinates (2, 1), (4, 2), and (8, 3) …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”