This is a simple ray tracing shell that I programmed with C++.

Ray tracing involves setting a scene of virtual objects with different colors and properties, and tracing a ray of light from a virtual eye to an imaginary plane through which we see the objects. Each pixel of that plane has a color that is determined by what objects it bounces off in the scene. Ray tracing involves describing the geometry of the objects in 3D space, as well as properties of light.

The complexity of this operation comes from the fact that rays of light will bounce off mirrors and be refracted by transparent objects; a single ray from the eye can therefore branch into several rays whose contribution has to be added recursively. Sources of light in the scene also have to be taken into account, as well as the shadows they cast.

My shell is pretty simple (6000 lines), as it was intended as a course assignment. Here is a sample of what it can do, a scene called: "MagicBox". In this scene, we see marbles inside a box with textured mirror sides. Some of the marbles are mirror themselves, so we can see the reflections of the other marbles, as well as the reflections of the reflections. In addition, the sides of the boxes present the reflections of the reflections of the reflections... up to 9 recursion levels...

You can get the code as a zipped archive: Compile the following files using Microsoft Visual C++ v.6.

If you just want to have a look at the text of my code, here is the main file, the geometry header and the geometry implementation.
Hosted by www.Geocities.ws

1