Creating a large outdoor landscape
In 3D game development, several common methods are used to create 3D landscapes. For relatively small terrains, the terrain can be modeled directly as a 3D object. The rendering of small terrain is no different than rendering other objects in the game. This section will focus on creating and rendering larger outdoor terrain.
Let’s start with something simple: instead of manually constructing the 3D terrain model, a flat image can be used to generate uneven and rolling 3D terrain. This technique is known as height mapping.
Height-mapping 3D terrain
A height-mapped 3D terrain uses a 2D grayscale image to set surface elevations: each pixel’s brightness defines the height of a corresponding grid vertex, as shown in Figure 7.7:
Figure 7.7 – The height map uses the grayscale value to represent height
In Figure 7.7, lighter pixels represent higher elevations, darker ones lower. By scaling these values, you can...