Normal Maps - Gameslinx/Tessellation GitHub Wiki

Normal Maps

Normal maps (or Bump Maps) are textures that tell the shader which direction the vertex 'normal' is. A vertex normal is a direction perpendicular to the vertex. These normals are often used for lighting. They require a map to add detail to a surface that doesn't contain that detail within the mesh. Normal maps are used in this shader to produce accurate lighting from different directions.

The red lines are the "normal" vectors for each vertex. A normal map creates fake normal vectors.

Normal maps use the RGB channels for the normal direction at that pixel:

  • Red - X axis
  • Green - Y axis

It is expensive to calculate accurate normals for tessellated terrain as the shader would have to calculate the slope between the adjacent pixels. Normals maps are much more effective for performance, but make sure that the normal map matches your displacement map or you may get inaccurate lighting.

Normal maps can also influence the reflection angle. When creating materials that reflect light, you can add some noise to the normal map to represent an imperfect surface.