Normal mapping allows us to perturb normal vectors so that the light bounces from the surface in the correct direction, making the appearance of additional detail on the surface where otherwise there is not. We have already added support for loading multiple textures for a mesh, both in the
MeshRenderer class in the Loading a static mesh from a file recipe in Chapter 3, Rendering Meshes, and within models in the previous recipe Referencing multiple textures in a material with the Visual Studio graphics content pipeline. Now, we need to update our shaders to sample the normal map and calculate the final normal direction.
Here, we will update the vertex structure and shaders to support passing a vertex's tangent vector from the loaded mesh in order to calculate the new normal direction. We also look at the changes necessary to support normal mapping within the tessellation pipeline if that is in use.