Bump mapping is the ability to add surface details, or bumps, through altering the surface normals across an object surface. By using a bump map, each normal at each pixel point can be altered in some displacement vector. Since the normal is changed at that point, so is the lighting. Surface bumps can be created in this way, because the normal will change the lighting to that point, and thus make it seemed raised or depressed, as more light reaches the eye or less light reaches the eye, increasing or decreasing the color intensity at that point. To make a raise, the normal is moved more in the direction so that light reflects more towards the eye, and vice versa for a depression.

A bump map is some function parameterized by u and v. To apply a bump map to a surface, we determine tangent vectors that change with respect to u and v along the surface we wish to bump along with the normal at that point. This defines a tangent plane is used to provide a coordinate system same as the bump map. The normal at the point should equal the normal on the bump map. By determining what new surface positions should be with repect to u and v, we can solve for the partial differentials with respect to u and v. From the partials, we can form a new normal, which is the object normal with a displacement vector determined by the partials.

In the actual implementation, I followed the course textbook in defining P and Q vectors for the coordinate system. The bump map is stored as an array of partials with repect to u and an array of partials with respect to v. The software reads them in from a PGM file, and calculates the difference in one pass with respect to u, and then the difference with respect to v on the second pass. When applying the bump, the software finds the normal at that point, knows what tangent vectors to use at that point, and calculates the P and Q vectors. P and Q are then scaled by the partials by lookup and then are used to calculate the displacement vector which is then applied to the normal. My bump map right now is only applied towards per quadrilateral face. I use the same texture mapping rules, bilinear interpolation, and use the barycenter to lookup the (u, v) in the bump map.

The only problems I had implementing this was I had a addition error, rather than a subtraction. So when I rotated a cube around, the bump would recede and protrude as the cube moved.

A bump map applied to a shiny green cube. The same bump map is used on all faces. As you can see, it looks raised on all 3 faces according to light cues. The problem with bump mapping is though, if viewed from the side, there will be no protrusion from the surface, it is only tricking the eye, by making changes to the surface normal. So if viewed from the side, a bump wouldn't look like a bump at all. The top edge along the left face looks black because the normal is pointing downwards. You can see the same feature on the top face where it is lit up, because the light is reflected in the direction of the eye.

The bump, but with the texture map that was used to generate the bump map.