Lambert diffuse lighting

From DmWiki

Lambert lighting is a simple local illumination model. It includes ambient and diffuse components, but no specular highlights.

It is based on Lambert's Law, which states that when light hits a rough surface, the light is reflected in all directions equally. Thus, diffuse lighting is view-independent: it looks the same from all directions. The reflectance is calculated by

k_{diff} = \mathbf{l} \cdot \mathbf{n}

where l is the vector from the surface to the light source, and n is the normal vector. Both must be normalized. This reflectance value is then multiplied by the light color and the surface color to get the final color you see on your screen.

In case the dot product is negative, the angle between the surface and the light source must be greater than 90 degrees, which means it is behind the surface. Thus the surface would not be illuminated at all.

See Also


DevMaster navigation