Ray Tracing

Effective as they can be at producing recognisable 3D scenes, Gouraud and Phong shading will never produce anything that could be described as photo-realistic. To achieve this, it’s necessary to use rendering techniques that mimic the physics of real-world lighting. The most commonly used of these are called “ray tracing” and “radiosity“. Ray tracing is especially useful for rendering images which contain reflective surfaces and transparent or translucent objects. As the name implies, it involves tracing the path taken by rays of light within a 3D scene but, contrary to expectations, it doesn’t start working from the scene’s light source but from the observer’s eye.

Lines, or rays, are projected from the observer’s viewpoint through the “camera” or window through which the 3D scene is viewed, one ray for each pixel in the window. Each ray’s path is traced into the 3D scene until it hits an object. It then uses the object’s attributes, such as the way the object reflects or refracts light, to calculate the path of further rays into the scene, following each of them in turn until they strike another object, when the process is repeated. At each stage, the colour of the object that the ray strikes is noted and the eventual result is a colour value which is plotted to the relevant screen pixel. If a ray is bounced off a shiny surface and hits a light source, a specular reflection will be formed. If it is blocked before it reaches a light source, then the object from which it last reflected will be in shadow.

If a scene contains a lot of shiny surfaces, a very large number of rays may be generated and traced before each pixel is finally assigned a colour. As a result, ray tracing a scene can require massive amounts of processing power, to the point where rendering a large image of a complex scene on a desktop computer can take many hours, if not days. To speed the process up a bit, most ray tracing programs restrict the number of reflections through which the path of each ray is traced.

This subject is well covered on the Web, with many personal and university sites carrying rendered images. One site that we can recommend is that of the Vienna University of Technology’s Institute of Computer Graphics.