Normal Mapping - How IT Works

How It Works

To calculate the Lambertian (diffuse) lighting of a surface, the unit vector from the shading point to the light source is dotted with the unit vector normal to that surface, and the result is the intensity of the light on that surface. Imagine a polygonal model of a sphere - you can only approximate the shape of the surface. By using a 3-channel bitmap textured across the model, more detailed normal vector information can be encoded. Each channel in the bitmap corresponds to a spatial dimension (X, Y and Z). These spatial dimensions are relative to a constant coordinate system for object-space normal maps, or to a smoothly varying coordinate system (based on the derivatives of position with respect to texture coordinates) in the case of tangent-space normal maps. This adds much more detail to the surface of a model, especially in conjunction with advanced lighting techniques.

Since a normal will be used in the dot product calculation for the diffuse lighting computation, we can see that the {0, 0, –1} would be remapped to the {128, 128, 255} values, giving that kind of sky blue color seen in normal maps (blue (z) coordinate is perspective (deepness) coordinate and RG-xy flat coordinates on screen). {0.3, 0.4, –0.866} would be remapped to the ({0.3, 0.4, –0.866}/2+{0.5, 0.5, 0.5})*255={0.15+0.5, 0.2+0.5, 0.433+0.5}*255={0.65, 0.7, 0.933}*255={166, 179, 238} values . Coordinate z (blue) minus sign flipped, because need match normal map normal vector with eye (viewpoint or camera) vector or light vector (because sign "-" for z axis means vertex is in front of camera and not behind camera; when light vector and normal vector match surface shined with maximum strength).

Read more about this topic:  Normal Mapping

Famous quotes containing the word works:

    That man’s best works should be such bungling imitations of Nature’s infinite perfection, matters not much; but that he should make himself an imitation, this is the fact which Nature moans over, and deprecates beseechingly. Be spontaneous, be truthful, be free, and thus be individuals! is the song she sings through warbling birds, and whispering pines, and roaring waves, and screeching winds.
    Lydia M. Child (1802–1880)