Next: Refraction Up: Algorithms Previous: Algorithms

Reflection

Reflection involves the generation of recursive secondary rays. The algorithm for reflection is based upon the physical model, which is described in [Serway 1990]. Using the normal to the surface, I calculate the reflected ray in the following way:

  1. The reflected ray uses the intersection point of the original ray with the object as its origin. I perturb its origin by a small amount (epsilon) away from the object along the intersection normal to ensure that the reflected ray won't hit the same surface.

  2. To calculate the direction of the reflection ray, I used the formula given in [Hearn &Baker] for specular reflection.

Reflection rays are secondary, and thus could potentially bounce through the scene forever. To stop that from happening, I impose a limit on the depth of secondary rays which can be generated.

The source for reflection can be found in the file render.c, in the function ReflectRay.


awscreen@noether.math.uwaterloo.ca
Wed Aug 2 20:30:34 EDT 1995