Normal Mapping

To add more depth to the game's graphics without hurting the frame rate too much I've implemented normal maps. Normal mapping is a technique used to add details to a model without actually adding any extra geometry. This technique results in much better performance than processing more polygons, as the GPU doesn't have to draw any extra triangles.

As with color maps, normal maps are wrapped around the surface of the object, with each pixel of the image assigned to a particular co-ordinate. Unlike color maps, normal maps do not store color, but instead use the RGB [Red, Green, Blue] component of each pixel in the image to define a vector [X, Y, Z], which the shading algorithm uses as the angle of the surface at the given point, over-riding the real surface angle of the mesh.

Below are three images: To the left is a basic plain, made of two right angle triangles, without a normal map applied, in the middle, a normal map generated with CrazyBump, and on the right, the same flat plain again, but this time with a normal map used in the lighting, rather than the real surface normals of the mesh. This results in the model appearing as if it has a much higher polygon count due to the shading, although if viewed from a low angle it can be seen to be a flat surface.