The most popular method of terrain synthesis is recursive subdivision, commonly called "plasma" (although there are other methods also called plasma). There's lots of demo code for this on x2ftp.oulu.fi, and I've implemented a couple of examples of subdivision methods in Java. The idea behind this method is to take your starting shape, usually a rectangle, and place random heights at the corners. Then you calculate the heights at the midpoints of each of the sides and the center by linear interpolation and add or subtract a random value from that height. Then recursively (or in a loop) you calculate the next levels of detail, adding smaller random values each time, until the map is complete.
Remember to scale the random factors added to each point by a value which is proportional to the lengths of the sides (the variance over 10 squares is larger than the variance over 5 squares)
This method can be made extremely fast when your stepsize is 2 and the map dimensions are a multiple of 2 as well. Unfortunately, this is a very difficult fractal when it comes to zooming in on an area. Unless you can control your random numbers at every conceivable x,y point, the edges of zoomed areas will not usually match up. This may not be an issue for your application; YMMV.
One major variation is to make the subdivision tile-based rather than edge-based -- some methods are described in SIGGRAPH Proceedings. Basically you generate all new corners for your tiles, and the original corners become the centers of new tiles.
Advantages: can be VERY fast.
Drawbacks: can show distinctive aliasing effects along the grid lines, tends to look most realistic from low angles (rather than from overhead), and doesn't give you rivers or vegetation. Can also give you problems joining together multiple tiles created with this method, unless you can work out a way to get the same random seeds for the edges.
This fractal suffers from a number of artifacts, usually ugly, due to the fractal characteristics of this method. These artifacts tend to be most visible when looking down from above, or when looking across the map directly down grid lines or diagonals. There are a few techniques that are used to reduce these artifacts:
Reference: Miller, Gavin S. P., "The Definition and Rendering of Terrain Maps", SIGGRAPH Conference Proceedings, 1986, p.39
point 1 = ( 9 * a + 3 * b + 3 * c + 1 * d ) / 16; point 2 = ( 3 * a + 9 * b + 1 * c + 3 * d ) / 16; point 3 = ( 3 * a + 1 * b + 9 * c + 3 * d ) / 16; point 4 = ( 1 * a + 3 * b + 3 * c + 9 * d ) / 16;Notice that each point is weighted more heavily towards the old points nearest it. This produces a fairly good rounded landscape without any randomness added in (demo courtesy of James McNeill).
Midpoint subdivision is used in a lot of "plasma" demos (e.g., the Mars Demo), sometimes with non-linear scaling of the resulting heights (e.g., squaring or cubing heights above sealevel to exaggerate mountains).
Up to the terrain synthesis page
Back to my home page
© 1996 firstname.lastname@example.org