next up previous contents index
Next: Glossary Up: Algorithm used in photo-realistic Previous: local illumination models   Contents   Index


Ray-tracing

The first successful attempt for a global illumination model has been made by Whitted [Whi80] by his ray-tracing algorithm. Whitted said: "If we trace light rays emitted from sources on their way through space and apply the laws of linear optics to precede their behavior when hitting objects we should get a good simulation approach." Amazingly simple, isn't it? But quite unusable for today`s number crunchers: imagine how many rays you have to emit from a light source when trying to illuminate a scene - an infinitive number of rays if we won't stuck to a dark picture with some colorized spots. Quo vadis? No, because we are only interested in rays which reach the observer (its philosophical, but rays which doesn't reach the observer are equal to non-existing rays - from the viewpoint of the observer!) and one theorem of linear optics rules that the ray path could be reversed. With this in mind Whitted stated: "We trace rays backward - from the observer through many interactions to..." - to where? Every experienced computer scientist knows that a successful algorithm has to be finite in the first place (or what would you think about an algorithm which could answer every question you have - but runs indefinitely long?) Whitted decided that the tracing should end when
  1. The ray enters the void (will not hit any object).
  2. The ray hits a pure diffuse surface.
  3. The energy of the light falls beyond a given level (further interaction will be unimportant).
  4. The maximal number of interactions has been reached.
O.K. we shoot rays from our observer position into the scene and look if they hit any objects. When this occurs we apply the laws of linear optics: if it is a shiny object we compute an reflected ray; if the object is transparent too we have to compute a refracted ray too. Then we distribute the energy of the incoming ray among the generated ray and trace them recursively (remember the recursion depth introduced above? This could become handy if the ray has been "caught" by two parallel perfect mirrors which would lead to an indefinitive number of recursions). But why ends the recursion when hitting a pure diffuse surface? This points out the biggest disadvantage of this algorithm: it can only handle specular interactions because light propagation has been modeled with rays. It would need an infinitive number of rays to model a diffuse reflection properly. Besides, the computation of only one ray for reflections/refract-ions results in pictures which are to "mathematical correct" to be real - an advantaged version of the ray tracing algorithm, the distributed ray tracing, generates multiple rays pertubated through a mixture of pure stochastic and surface-property related distortions. The neglection of the diffuse component lead to a hybrid approach: during each object interaction handling a local illumination model will be used to fake the diffuse component. That's why most ray-tracer provide e.g. two parameter sets for the reflectivity of a surface material: one rules the ray-traced reflectivity, the other rules the diffuse/specular component of the local illumination model. (Physicist wouldn't accept such an illogical separation - but we (the engineers) are the guys which build the computers!). This has a nice side effect: for computing the local illumination component we need the vector $ \vec{l} $ which points from the hit point to the light source. This vectors becomes handy when doing shadowing calculations: to determine if the hit-point is shadowed by something we simply have to generate a ray (sometime called shadow sensor) in the direction of $ \vec{l} $ and test if it hit other objects - if not then the hit point couldn't be shadowed!

That's all you need for the basic ray tracing algorithm. You may ask how many rays have to be fired into the scene - the answer is easy: imagine that you have the rendered picture on your computer screen. You are the observer placed virtually at the observer position in the virtual scene. If you look at the picture your eye scan the picture pixel by pixel. If we see the computer screen as a window into the virtual world we simply have to extend your "view-ray" from your eye through a pixel on the screen into the scene and see what would happen with them - that's ray-tracing!


next up previous contents index
Next: Glossary Up: Algorithm used in photo-realistic Previous: local illumination models   Contents   Index
Rüdiger Knörig 2002-06-09