Ray Tracing, Hurts
Saturday, September 22nd, 2007I am enjoying this weekend quite a bit more than usual. The reason; last weekend. From about 10 PM September 13th until 4:30 PM September 17th I was working on a ray tracer for my computer graphics course.
Wikipedia has a great entry about Ray Tracing.
Ray tracing is a general technique from geometrical optics of modeling the path taken by light by following rays of light as they interact with optical surfaces… The term is also applied to mean a specific rendering algorithmic approach in 3D computer graphics, where mathematically-modelled visualisations of programmed scenes are produced using a technique which follows rays from the eyepoint outward, rather than originating at the light sources. …facilitates more advanced optical effects, such as accurate simulations of reflection and refraction…
I was honestly kinda blown away that this was our first assignment for my computer graphics course. In the end I was happy with my results, and feel that I learned a lot from the project, and had enough weight in the gradebook to warrent the time. While I worked in the lab, we averaged about four people programming there way through the project. The idea for the ray tracer is simple. Follow the ray from the view point, to each dot you want to draw, and if you intercect a object, paint it. Turns out the math to calculate the intersections and lighting was a little more than I was hoping for. While working on the project I realized I hadn’t worked with C++ in over a year, and I have never claimed to be a C++ master. I was very happy with my very object oriented and abstracted solution that allowed troubleshooting to done quickly and abstracted the topics to a level I could program a solution for. (I had many classes such as scene, camera, point, vector, ray, primitive, triangle, sphere etc. I defined operations such as dot product and cross project for vectors. Also utilitzed a virtual function in my primitive type to call the correct funtion depending on the primtive. The primitive class also allowed me to load all of the shapes into one vector or pointers to primitives. Most others were simply managing a vector per shape.)

