Sunday, June 27, 2010
Work has slowed down and has allowed me time to get started on a side project (and update my blog!) If you read my last post I asked for help figuring out what I should do for a side project, but I completely ignored all my ideas in that post and decided to write a ray tracer!
As you can see from the picture, that is the progress I have made so far. I have a simple scene that has spheres, planes, and point lights. I have implemented basic diffuse and specular lighting, as well as reflections, shadows, and 4x super sample anti-aliasing. I was able to get this up and going to this point working on it for about four nights. I loosely followed this tutorial, I found it to be very helpful getting started, but I would have appreciated if he had commented his code or named is variables better. I was able to figure out what he was doing and add a few small fixes as I saw fit (for example allowing resolutions that were not 4:3 aspect ratio).
For the future of this project I will be adding camera code next, which will require me to set up some math classes for matricies and quaternions first. After camera code, I will probably try to set up an actual asset loader, set up the ray to triangle intersect functions, and get textured objects on screen and running. I also want to get this either multi-threaded running on the CPU or just running all on the GPU. I think I prefer the GPU method, but I may try both. I have been meaning to try out Intel's Theading Building Blocks for a while now, and a ray tracer is a very easy thing to parallelize.
So far this has been a really fun little side project, if you haven't written a ray tracer I would suggest trying it. It is fairly simple and you get good looking stuff on screen really fast, so its very rewarding. I will be adding more blog posts as I progress.