Real-Time 3D Graphics with WebGL 2
上QQ阅读APP看书,第一时间看更新

The Lambertian Reflection Model

Lambertian reflections are commonly used in computer graphics as a model for diffuse reflections, which are the kinds of reflections where an incident light ray is reflected in many angles instead of just one angle, as is the case for specular reflections:

This lighting model is based on the cosine emission law, or Lambert's emission law. It is named after Johann Heinrich Lambert, from his Photometria, published in 1760.

The Lambertian reflection is usually calculated as the dot product between the surface normal (vertex or fragment normal, depending on the interpolation method used) and the negative of the light-direction vector. Then, the number is multiplied by the material and light source colors.

Light-Direction Vector

The light-direction vector is the vector that starts on the surface and ends on the light source position. It is essentially the vector that maps the light's position to the surface of the geometry.

Where:

is the final diffuse color,  is the light diffuse color, and  is the material diffuse color.

That being said, we'd derive the final diffuse color with the following:

If L and N are normalized, then: