Now consider lighting each pixel and recall the basic behavior of light from Section 4.1. The virtual world simulates the real-world physics, which includes the spectral power distribution and spectral reflection function. Suppose that a point-sized light source is placed in the virtual world. Using the trichromatic theory from Section 6.3, its spectral power distribution is sufficiently represented by R, G, and B values. If the viewing ray hits the surface as shown in Figure 7.2, then how should the object appear? Assumptions about the spectral reflection function are taken into account by a *shading model*. The simplest case is *Lambertian shading*, for which the angle that the viewing ray strikes the surface is independent of the resulting pixel R, G, B values. This corresponds to the case of diffuse reflection, which is suitable for a ``rough'' surface (recall Figure 4.4). All that matters is the angle that the surface makes with respect to the light source.

Let be the outward surface normal and let be a vector from the surface intersection point to the light source. Assume both and are unit vectors, and let denote the angle between them. The dot product
yields the amount of attenuation (between 0 and ) due to the tilting of the surface relative to the light source. Think about how the effective area of the triangle is reduced due to its tilt. A pixel under the *Lambertian shading* model is illuminated as

in which represents the spectral reflectance property of the material (triangle) and is represents the spectral power distribution of the light source. Under the typical case of white light, . For a white or gray material, we would also have .

Using vector notation, (7.1) can be compressed into

in which , , and . Each triangle is assumed to be on the surface of an object, rather than the object itself. Therefore, if the light source is behind the triangle, then the triangle should not be illuminated because it is facing away from the light (it cannot be lit from behind). To handle this case, the max function appears in (7.2) to avoid .

Steven M LaValle 2016-12-31