In 3D computer graphics, ray tracing is a rendering technique for generating an image by tracing the path of light as pixels in an image plane and simulating the effects of its encounters with virtual objects.

Ray tracing is capable of simulating a variety of optical effects, such as reflection and refraction, scattering, and dispersion phenomena (such as chromatic aberration).

Path tracing is a form of ray tracing that can produce soft shadows, depth of field, motion blur and indirect lighting. Path tracing is an unbiased rendering method, but a large number of rays must be traced to obtain high quality reference images without noisy artifacts.

In 1976, Scott Roth created a flip book animation in Bob Sproull’s computer graphics course at Caltech using ray tracing with a simple pinhole camera model. Roth’s computer program noted an edge point at a pixel location if the ray intersected a bounded plane different than that of its neighbors. Naturally, a ray could intersect multiple planes in space, but only the surface point closest to the camera was noted as visible. The edges are jagged because only a coarse resolution was practical with the computing power of the time-sharing DEC PDP-10 used.

A typical setup includes a light source of some finite value. The scheme using transparent spheres can allow the ray tracing to capture colors and make the resulting image more interesting if the programming is done properly.

Ray Tracking and vector calculus

The recursive technique as shown above is not hard to translate into machine language. Vector algebra is needed to handle the 3D scene. Work to detect intersection from the ray to an object has to be considered.

It may at first seem counterintuitive or “backward” to send rays away from the camera, rather than into it (as actual light does in reality), but doing so is many orders of magnitude more efficient. Therefore, the shortcut taken in ray tracing is to presuppose that a given ray intersects the view frame. After either a maximum number of reflections or a ray traveling a certain distance without intersection, the ray ceases to travel and the pixel’s value is updated.

Ray traced scene

One major problem with ray tracing or any computer graphics is obvious. There are hardly no color graphics terminals available. Color printers are another problem.