Unil now, two objects have not interacted with each other. However, one piece of geometry might block light from reaching another, resulting in a shadow.
Suppose we are trying to find the color at a certain point on an object. We will do the following:
Cast a ray from that point to each light source.
For each ray, we will perform an intersection test with each other piece of geometry in the scene.
If the ray intersects with any geometry before reaching the light source (intersecting at `0 < t <= 1`), the point is in shadow from that light source.
If the point is in shadow from a particular light source, we will ignore the diffuse and specular contributions from that light source when computing the Phong illumination.
We will continue including the contributions from any lights that are not blocked by other objects. We will also always include the ambient term. This term approximates indirect lighting, ensuring shadowed areas are not completely black.