The raytracer was a project I worked on for my university classes. It took us quite a bit of time to get it up and running. It’s funny how some of the math seems obvious at first but then turns out to be fairly complex.

I have my original presentation page with the screenshots we thought were the most advanced.

Note that the raytracer outputs the pnm-format output on stdout. You need to pipe it to pnmtopng (or cjpeg, etc.) to get an output file from it. Here is an example:

./rt script_file_name | pnmtopng > output.png

We documented the progress and evolution of the raytracer through a number of screenshots. We also tried to re-create the train image that our prof had supplied in class:

I believe there’s still a bug in this raytracer where objects behind a light source will cast a shadow in front of it. As far as I know, it’s the only bug (besides its lack of support for textures and many primitives).

Read full post