
CHAPTER NINE: Shaders and Rendering Algorithms 265
[Figure 9.16]
In raytracing, a ray (shown
in yellow) starts at the cam-
era, then bounces o visible
objects.
When the ray hits an object, the object is checked to see if it is refl ective
or refractive, or may be receiving shadows, which need to be computed by
sampling other rays. If the object were refl ective, for example, then after
computing the diffuse and specular shading of the point on the surface, an
additional ray would be traced bouncing off the object into 3D space, check-
ing if any other object’s refl ection would appear at the point being rendered.
If another refl ective object was encountered, ...