Michael Bradford Williams

Home / Programming / Ray Tracer

Ray tracing is a technique for rendering image. The main idea is to trace (backwards) the path of rays of light from a virtual camera (a point in 3D space), through each pixel in a virtual image (a rectangular region of a plane), and into a virtual scene containing the objects that will appear in the image. One advantage of this approach is that a high degree of realism can be attained with pysically accurate models of how light interacts with various types of materials (e.g., shadows, reflections, refraction, etc.). One disadvantage is that it can be very computationally expensive.

Below is a (relatively) basic implementation of the ray tracing algorithm. It has the following features:

A number of different scenes (mostly basic ones for testing) can be selected, and the position of the camera can be controlled. The camera is always pointed at the origin. WARNING: performance in Firefox, at least in my experiments, has been very poor.

Here is a larger version of this program more suited to desktop browsers.

Scene:
Camera X: Y: Z:

Your browser is currently unsupported.