# Terrain flatten

Document Sample

```					TerrainGeneration with
Heightmaps

CS 536
By Mauricio Castellanos
Terrains should…
   appear continuous to the player.
   Appear realistic to the setting of the game
   Appear static, even if a level-of-detail(LOD)
algorithm is used.
What will I cover:
   Heightmaps
   Terrain generation
Heightmaps
   A standard way of creating 3d terrains is through the use of
heightmaps
   A heightmap is simply a 2d array of values
Terrain Generation
   Steps to create a heightmap:
   Initial Creation
 Midpoint Displacement
 Fault lines

 Hill Algorithm
   Smoothing
   Scaling
Midpoint Displacement
   Also known as the diamond square method.
   Midpoint displacement: is a subdivision algorithm that starts out adding
larger details to the terrain and creates smaller more intricate detail as it
subdivides the heightmap.

   There are 2 steps:
   The diamond step
   The square step.
Midpoint displacement
example:

Figure 2
Figure 3
Fault lines method

Figure 1   Figure 2   Figure 3
Hill Algorithm
   The hill algorithm is a simple iterated algorithm with a few
parameters that can be varied to change the characteristics of the
terrain
1. Start with a flat terrain (initialize all height values to zero).
2. Pick a random point on or near the terrain, and a random radius between
some predetermined minimum and maximum. Carefully choosing this min
and max will make a terrain rough and rocky or smooth and rolling.
3. Raise a hill on the terrain centered at the point, having the given radius.
4. Go back to step 2, and repeat as many times as necessary. The number of
iterations chosen will affect the appearance of the terrain.
5. Normalize the terrain.
6. Flatten out the valleys
One hill
Multiple Hills
Terrain Generation
   Steps to creating a heightmap:
   Initial Creation
 Midpoint Displacement
 Fault lines

 Hill Algorithm
   Smoothing
   Scaling
DEMO
Sources
   http://collective.valve-erc.com/index.php?doc=1040644009-23694100
   http://www.gameprogrammer.com/fractal.html#diamond
   http://www.robot-frog.com/3d/hills/hill.html
   Terrain rendering brute force: http://www.two-kings.de/tutorials/terrain/terrain01.html
   http://tulrich.com/geekstuff/chunklod.html
   http://tulrich.com/geekstuff/siggraph02-slides/img0.html

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 38 posted: 3/16/2011 language: English pages: 14