Normal Maps

It is easy to modify our shader so that it obtains the normal perturbation values from a texture rather than generating them procedurally. A texture that contains normal perturbation values for the purpose of bump mapping is called a bump map or a normal map.

An example of a normal map and the results applied to our simple box object are shown in Figure 8.10. Individual components for the normals can be in the range [–1, 1]. To be encoded into an RGB texture with 8 bits per component, they must be mapped into the range [0, 1]. The normal map appears chalk blue because the default perturbation vector of (0, 0, 1) is encoded in the normal map as (0.5, 0.5, 1.0). The normal map could be stored in a floating-point texture. Today’s graphics ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.