Many objects, for example, wood and paper, will have a surface that is not shiny. Such objects can be modeled using the Lambertian Model.

Lambertian Shading Model

A Lambertian object obeys Lambert’s cosine law, which states that:

The luminous intensity of a surface is proportional to the cosine of the angle between the surface normal and the direction of the light.

ccosθorcnl

Both n and l are unit vectors.

Note that the model does not depend on the distance between the light and the object. This assumption is equivalent to saying that the light is “distant” relative to the object size, which is often a directional light.

When the light hits the surface, a portion of the light gets reflected. This is controlled by the diffuse reflectance cr, a color that varies depending on the surface. Also, the surface color can be made darker/lighter by changing the color of the light source cl.

c=crclnl

cr and cl are RGB colors with components in the range [0,1], where the multiplication is done element-wise, so cr;cl returns another RGB color. Note, however, that the product nl might create negative values (e.g., when the surface normal is pointing away from the light). To solve this, we can use the max function:

c=crclmax(nl,0)

Ambient Shading

Some surfaces that receive no direct illumination in real life are perceived as having a color distinct from black. This is because the light is actually reflected by other surfaces. In addition, there’s sometimes skylight, which increases the amount of light reflected.

A common trick is to put a dim light at the position of the eye so that all visible points receive some light. Another approach is to add an ambient color ca, which is simply a constant value that interacts with the diffuse reflectance cr.

c=crca