Normal mapping

The first effect that we are going to cover is called normal mapping. You may recall from earlier chapters that a polygon's "normal" is the vector pointing directly away from (perpendicular to) the polygon's surface.

Normal mapping

We use this normal when calculating lighting, where the amount of diffuse lighting for a given polygon is the dot product of the polygon's normal and the light direction. Until now, we have relied on the model file itself to give us each vertex's normal vector, but there are other more creative ways to obtain a normal.

The following screenshot depicts a flat rectangle with a brick texture applied to it. Because the wall ...

Get 3D Graphics with XNA Game Studio 4.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.