O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Applying a Heightmap

You may have noticed something peculiar about the terrain you created in the last section—it was flat. If you want the terrain to have a more realistic look to it, you can load a heightmap. A heightmap defines the landscape of your terrain. In other words, it informs the program where any bumps, mountains, and valleys should occur. Heightmap images are made in Grayscale mode, which means that there is no color in them, just 256 shades of gray. Anything that is fully white in the heightmap represents the highest peak, while anything that is completely black represents the lowest point. The shades of gray in between will make up the valleys and mountains in your terrain. Look at Figure 9.7 to see how the heightmap would convert ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required