I recently had an in class test on ray tracing (which I got full marks on). In order to get maximum use from all the revision I did I’ll also be flogging the subject here. So this is a series of straight forward articles on ray tracing, but first just explaining the general idea.
So what is it?
It is a method of rendering scenes usually characterised with a checkerboard floor, ultra-shiny surfaces and all perfectly sharp and crisp. The idea is very much like how light works in the real world, but in reverse. The 3d has a camera from which rays travel from.

The above diagram shows a simple ray tracing scene. The Projection Plane is the display which the rays intersect as they fly into the world. A ray intersects this plane for each pixel on your screen. The Projection Reference Point behind it is a single point in space that they originate from. This allows the rays to all fly out at a different angles.
Primary, Secondary
Rays that originate directly from the projection reference point are the primary rays and when they hit an object two secondary rays are created. One is for flying off to record any objects or lights reflecting onto the object that was hit. The other is for going through the object to record any light refracting through the object (but obviously only if the object is transparent).
When a secondary ray hits an object the above process will repeat, and repeat, and repeat slowly building a tree of all of the reflections and refractions of light that can be recorded from the original primary ray.

This process will stop if there are no more objects to hit (in which case it’s just background colour), if the ray hits a light (no point reflecting off them, you’ve just got full light), if you have set limit on the number of sub-rays to create and if the impact that the sub-ray will have on the primary ray is too small for us to notice.
The original primary ray is used to find the colour of a pixel on the screen, and to do this all we need to do is walk up the tree of sub-rays from bottom to top looking at each object in turn. This also needs to take into account the lighting on the object (diffusion, any specula highlights and ambient lighting) and the distance of the object to add fog.
End
That’s the basic model, but next time I will be writing about some more advanced algorithms used in ray tracing for making it more efficient and for making more realistic images.

















