Thursday, July 19, 2012

Mastering C++ - Raytracer

After my little chess game, I felt a bit more ambitious and I started on implementing a simple ray tracer. I partially borrowed the basic structure for the program from the appendix of the book Advanced Global Illumination.

The implementation proved to be quite a struggle, since the books don't prepare you from the errors. The errors from the compiler aren't a great help either and having a null pointer just stops the program leaving you no clue about where it all went wrong.

However, after a little less than 25 hours of programming, I finally managed to calculate the direct lighting in a simple cornell box with two spheres.
Cornell box with two spheres. Rendered with path tracing and 1000 rays per pixel.
The code, however, is a little bit messy and could be a bit more efficient. The next step is code cleanup, a little documentation and calculating the global illumination in the scene.

No comments:

Post a Comment