[:|] robot frog
news
3d
games
icons
picts
misc
links
 

Terrain Generation Tutorial: Flattening

previous | next | code

The terrain we just created looks pretty nice, but there is not much in the way of flat valleys on it. If this is what you are looking for, then you can be done now. However, it might be nice to have some more lowlands. What we need is a way to flatten out the terrain some without flatten out the mountains. Since we have already normalized our heightmap to the range (0, 1), a simple way to broaden the low areas is to square each height value. This will effectively lower the midrange height values without affecting the maxima too much. Graphically, it maps something like this:

The next image shows how flattening affects a generated terrain.


The terrain on the left has not been flattened. The terrain
on the right has been flattened by a power of two.

If even more flattening is needed, you can raise the height values to even higher powers. On the next page, we'll learn a simple modification to the algorithm to generate islands.

Copyright © 1999-2002 Bob Nystrom.