There are many different ways to do normalmapping. The most common are object space or tangent space.
In an object space normalmap, your texture stores normal values directly in the same coordinate system as the object itself. The shader just looks up a normal value from the texture, and uses it directly in the lighting computation.
- Conceptually very simple and easy to understand.
- Plays well with dynamic geometry systems like terrain generation, vertex displacement, progressive meshes, etc.
- Cannot reuse a texture on different parts of the model (if a texture holds normals for a brick wall that faces east, these normals would be wrong if that texture was also mapped onto a brick wall that faced north)
- Not easy to update normals to account for objects that deform (eg. skinned animation)
- Normalmaps contain values pointing in all possible directions, so are not easy to compress
Tangent space normalmapping, on the other hand, only stores the difference between the non-normalmapped surface normal and the desired normal into the texture. To decode this information it must also store the vertex normal, tangent, and binormal. In the shader, it looks up a value from the normalmap texture, then multiplies this with a 3x3 matrix formed from the vertex normal, tangent, and binormal, which moves the normal value from tangent space into object space prior to the lighting computation.
- More complex to implement.
- If not careful, can cause popping when used with dynamic geometry systems.
- Can reuse a single normalmap texture regardless of which way the surface is facing.
- Easy to support deformable meshes.
- Normalmap data points mostly straight out, with only small deviations from that, so they compress very well.
The normalmapping sample on this website implements tangent space normalmapping, as do most games today: that is generally considered to be the most flexible and efficient approach.
For your scenario, though, I suspect object space normalmaps would be a lot simpler.
XNA Framework Developer -
blog -
homepage