Normal Mapping is a bump mapping technique where the derivation of the (per pixel) surface normal) to the per vertex or per triangle normal is encoded into the rgb channels of a texture. This is often called DOT3 bump mapping.

To calculate the correct displacement in tangent space, the shader has to be supplied with a basis that spans the tangent space.
A common basis are the normal vector, the tangent vector and the binormal vector at each surface vertex point. The normal vector and the tangent vector has to be calculated before rendering and has to be supplied to the shader. The binormal vector can be calculated via a cross product of the normal and the tangent vector.
A vertex structure that holds the information needed for the vertex shader could look like this:
struct vsInput { float4 Position : POSITION0; float3 Normal : NORMAL0; float3 Tangent: TANGENT; float2 texCoords : TEXCOORD0; };
where texCoords denotes the texture coordinates to look up the texture and the normal map.





