OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition
by Dave Shreiner, Graham Sellers, John M. Kessenich, Bill M. Licea-Kane
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access