A normal map refers to a color-coded bump map that the game engine can use to dynamically render faux 3D surfaces on a model from any direction. Unlike a grayscale bump map, whose relief is only applied to the model on a per-vertex basis, a normal map provides relief on a per-pixel basis, using the colors in the map to create artificial normals on the object's faces. First let me explain what an object's surface normals are and how an object reflects light in a program.
Every face, or triangle, on a 3D model has an invisible attribute called a normal, which is a vector pointing away from and perpendicular to the face. This vector is a line that the rendering software uses to determine how the light in the scene should reflect from the face. In essence, the greater the angle that the normal is from the direction that the light source is pointing at the model, the darker the face appears in the scene. Conversely, face normals that point closer to the direction of the light source appear lighter.
Until recently, modeling and game software rendered each face of a model, based on the face's normal, by creating a lighting gradient and shading the face appropriately by interpolating the adjacent normals of the vertices that made up the model's mesh. This is known as per-vertex shading, or Gouraud ("goo-row") shading. Although it provided some lighting realism, it wasn't a smooth rendering technique. With the advent of newer DirectX shading technology and video cards that could handle it, per-pixel shading came of age. This meant that faces on a model could be lit on a per-pixel basis according to a normal map.
A normal map is a texture map that a rendering program uses to generate individual pixel normals for the faces on an otherwise low resolution (low polygon count) model. The normal map is a red-, green-, and blue-shaded image that dictates how the faces of a model should be lit. The program looks at the colors on the map and interprets them as a height map, where individual pixels on the map represent vectors. The red, green, and blue values of the normal map are respectively interpolated as X-, Y-, and Z-coordinate values for individual normals. The software then illuminates the faces of a model according to the values of these normals.
This process might seem complex, but it really isn't. In Chapter 6,1 will show you how to create normal maps and apply and render them in real-time.
Was this article helpful?