Basic ray tracer, C++.

Here is a basic ray tracer i wrote  years ago. The goal was to write a simple ray tracer, in order to understand ray tracing concepts and maths. The program takes a text file as input, and produce a .tga file as output. The code is easily readable and can be interesting for someone wanting to write his own raytracer. I used the classic recursive algorithm. If you plan to do some serious rendering, you should consider to use complete solution like Povray, sunflow or yaffray open source projects.

Features : rendering plane, boxe, cylinder, cube , all quartics, and torus.
Light: diffuse, specular on each RGB channel, ponctual and spot.
Reflexion, refraction, super adaptative anti-aliasing, matrix class, equation solver up to fourth degree (for torus). No size limit for output.

The code is only C++ and does not rely on any library.

Click on pictures to get full 640x480 size screenshots.

Image













RayTracer64BitsBin (69.3Ko) Linux 64bits binary.                  RayTracerSrc (57.9Ko) source code.