Graphics Reference
In-Depth Information
Adding depth to a mesh with a bump
map
For detailed models, you require geometries with a large number of vertices and
faces. If a geometry contains a very large number of vertices, loading the geometry
and rendering it will take more time than it would take for a simple model. If you've
got a scene with a large number of models, it is a good idea to try and minimize the
number of vertices for better performance. There are a number of different techniques
that you can use for this. In this recipe, we'll show you how you can use a bump map
texture to add the illusion of depth to your model.
Getting ready
To get ready for this recipe, we need to get the textures that we want to use on our
geometries. For this recipe, we require two textures: a color map, which is a stand-
ard texture, and a bump map, which describes the depth associated with the standard
texture. The following screenshot shows you the color map that we will use (you can
find these textures in the
assets/textures
folder in the sources provided with this
book):
As you can see, this is a simple color map of a stone wall. Besides this texture, we
also require the bump map. A bump map is a grayscale image, where the intensity of
each pixel determines the height: