Game Development Reference
In-Depth Information
13.8 Summary
We can model terrains using triangle grids with different height
values that create mountains and valleys, simulating a terrain.
A heightmap is the data set that contains the height values for the
vertices of the terrain.
We can texture the terrain using an image on disk as the texture or
by generating a texture procedurally.
We light the terrain by computing a shade factor for each quad that
specifies how bright/dark it should be. The shade factor is deter-
mined by the angle at which the light strikes the quad.
To have the camera “walk” over the terrain, we need to find the tri-
angle that we are standing on. Then we compute two vectors on
the adjacent and opposite sides of the triangle. The height is then
found by linearly interpolating on each of these vectors using the x-
and z-coordinates in a normalized cell with an upper-left vertex at
the origin as parameters.
Team-Fly ®
Search WWH ::




Custom Search