Bump Mapping

Bump Mapping is a technique used to make surface look more realisitc by adding irregularities to them like bumps, scratches and so on. While the aim in using the technique is similar to the use of Displacement Mapping, Bump Mapping does not alter the geometry of an object. It relies on pertubing the face normal at every point on the surface, for which a color must be computed, resulting in brighter and darker areas on the surface.

In action

Bump mapping can be seen on the floor and, if one looks closely, on the brick walls in the doorway. It was used where displacement mapping would just have been too expensive or where the additional face count would not have resulted a noticeable improvement of the image's visual quality.

Implementation idea

When a ray hits a surface and its color value needs to be computed, the standard phong shader calculates the reflectance of the material by the angle of the light and view vector with respect to the face's normal. For bump mapping, a second texture is applied to a face which serves as a heightmap, defining the height of the surface at different points.

The Bump Mapping shader now reads out the height value for the current point from the heightmap, and calculates the color value gradient from the surrounding heightmap pixels. It then returns a modified normal which was shifted along the texture coordinate axes corresponding to the color gradient. Then the object is shaded like an ordinary face, just with a different normal.

Changes made