CS488 - Introduction to Computer Graphics - Lecture 19

Ray Tracing

The idea is simple:

for each pixel
  calculate the eye/pixel ray
  project the ray into the scene
  find the first intersection
  apply illumination and shading calculations
  colour the pixel with the result


Until now rendering has

Ray tracing is different. It


Until now we looped over graphics primitives


  1. Loop over primitives is inside the loop over pixels

Ingredients of Ray Tracing

Eye-pixel ray

E + t*(P - E)

Object in scene

Set of points {Q} satisfying

Solve the equation

The surface might be defined by an algorithm, then use a root-finding method

Object is planar, e.g. a triangle

Equation of the plane is \sum_i ai*xi = b. Where do the parameters come from?

Substitute eye ray into the plane equation and solve for t, which is just finding the solution of a linear equation

Another idea: intersect in object coordinates

Shading for Ray Tracing

When we have found the intersection point we need to calculate a colour.

We know

  1. The eye ray, V
  2. Surface properties
  3. The normal vector

For each light

  1. Calculate illumination: RGB, l

    Accumulate outgoing light

How about shadows?

In principle,

  1. Do an intersection test from the light
  2. If it hits the eye ray intersection, then


How about reflections?

Return to: