Ray Tracing (CS6620) - Project 2
You can find the source code here
Here is the required image generated by my raytracer:
Download as png or ppm
Download the scene file
I calculated this material like the other materials. This material has just more things going into the resulting color. To find bugs I also added an OpenGL viewer helper. This was a big help to find my bugs.
OpenGL Viewer - This viewer is simple, but I I'll be adding features as the semester continues. After I get some acceleration methods in, I'm hoping it will be interactive. Currently you can load scene files, click a render button, then the OpenGL display loop will display the rendered scene. Doing this makes it possible for you to change a scene file without having to re-run your program. Another debugging feature is when you click on the image, it will shoot a ray wherever you clicked. So I can set a breakpoint and click on an object that I want to know the behavior. This helped me find several bugs.
Dielectric Material - I was fairly confused on what exactly I was doing when I first looked into the assignment. Then I found that this material has a couple characteristics that determine the resulting color. First like any other material, I calculate the hit position and the normal. Next I go through every light and add specular highlight just like Phong Material (funny this was my biggest problem). Next I find if there is total internal reflection, otherwise I find the reflection and refraction. Oh and don't forget Beer's Law! Everyone of these are more complecated then I thought they would be.
Funny I had more difficulties on this assignment then the first one, yet the first one was a lot more work. I pretty much had a difficulty in every section of the material. I also found certain techniques essential to solving my problems.
Reflection/Refraction - It's really hard to figure out if your reflection is correct on a box, if your intersection is wrong. I re-wrote my reflection a few times before I realized I wasn't intersecting both faces of the box (I wasn't counting the intersection with the normal is pointing in the same direction of the ray). Once I fixed my exiting ray intersection on the box, my reflection and refraction was correct.
Beers Law - I did this completely right at the beginnning, but since I had the original scene file the colors were wrong. I thought this was my bug and ended up losing a lot of time because of it. I guess there was an email to tell everyone about it but I missed it, my friend told me about it.
Little lighting issues - I was actually caculating phong wrong which was a big problem for me. I think everything is correct now :).
I spent around 20 hours on this assignment. I thought this was a hard assignment only because I kept doing the wrong things thinking it was right. I had to have people tell me things were wrong on the web page, or the scene file had something wierd or whatever. I could have completed this assignment a lot faster and gotten a better understanding if we would have gone thorough a derivation of the reflection and refraction in class. Rather then just saying, 'Here are some slides, they may be a little wrong'.
Lots of reflection and refraction!
For the first project I created a scene file generator, but I didn't use it for this one. To build this scene file I made my scene have a very small resolution and I moved objects around until it looked cool to me. This was a bit easier to test things out since I made my OpenGL viewer that just re-reads the scene file, and re-renders the scene.
In this scene there is a metal disk to the right (in the background), and a metal plane to the left in the back. The subject of the scene features three spheres (two are dielectric) over a dielectric box. This scene took a rediculous amount of time, mostly because I get an error in my viewer when I try to run it in Release Mode. When I rendered this at 1024 X 1024 it took about 14 minutes. While it was rendering, I was writting this design doc. To get everything positioned where I wanted it, I was only rendering at depth 4 and my window size was 128 X 128. With my OpenGL viewer this was a lot easier. I tried to make it as balanced as possible, but the background metals were difficult to position. When I decided to take the time to render the BIG image, I set the depth deeper then necessary (just so I wouldn't have to do it again). You can see a lot of antialiasing, so I say we need to fix that!! That is all.
Download as png or ppm
Download scene file
Right now this viewer is really simple, but there are a lot of features I'd like to add as the semester continues. Currently with the program you can select a program file from a list box and the program will read the scene file. When you press the Render button, it will display the image to the window. While running, you can click the left mouse button to shoot a ray into your current scene. This is very helpful for debugging! I am currently unable to run it in Release Mode so it is slower then it should be.