Fractal terrain is usually considered as a stochastic generalization of the von Koch Curve. It is generated by "diamond" algorithm.
We start with a square. At the corners we set four random values and scale them by d. Next we divide this square into four equal squares. At the edges of the original squares we set four new points and one point at the centre. The values at that points are calculated from:
dn = (0.5)H/2dn-1+avg
where: avg is an average values of neighbouring points. This algoritm is repeated to every new square.
You can set value of d from 0.001 to 2. Small values correspond to flat terrain, whereas high values to "mountains".
Changing value of H (in the range 0.001-10) has effect on roughness, high values give smooth terrain, low values - very rough.
Resolution is order of the mesh. The size of the mesh is 2Resolution x 2Resloution. Value is in the range from 2 to 10.
Switching Color you can see fractal in blue (low points) and green (high points) colors or colord by rainbow.
another fractal-terrain applet (in 2D)
Back to main page