Diffuse Lighting Math

Diffuse lighting is proportional to the cosine of the angle between the surface normal and the vector to the light source.

This is computed by the dot product of the two vectors.