Malin's Magnificent Math
Home

Colour: Physics & Light

Radiometry

Reflection Functions

Illumination Models

Ray Tracing:

What is Ray Tracing?

Ray tracing is a rendering technique that simulates the way rays of light travel in the real world. The rays are used to calculate the image of a scene. In ray tracing though, the rays are caculated backwards from in the real world where rays of light are emitted from a light source and illuminate objects. The reflected, refracted and transparent rays are followed.

A camera is simulated and the rays are traced backwards starting from it. The objects are added to the scene. Then for every pixel in the final image one or more viewing rays are sent from the camera to see if they intersect with any objects in the scene. These are called "viewing rays".

The color of the surface is calculated when an object is hit. The rays are sent backwards to each light source to determine the amount of light coming from the source. These are called "shadow rays" and test whether or not a surface point lies in shadow. The reflected, refracted or transparent new rays are set up and traced in order to determine the contribution of the reflected and refracted light to the final surface colour.

Ray Tracing Algorithm:

For each sample
  For each primitive
    perform ray-primitive intersection
  Find the closest intersection
  Recursively trace rays
    (reflection, refraction, shadows)
  Compute color

Ray Tracing Programs:

The following picture was created using the Raytracer tool, POVray.