The following is a journal of assignment 4 written by Andrew Martinez, who took graphics in Winter 2000. We would like to point out that when you start on your raytracing assignment, one of the first things you should do is remove all traces of OpenGL.
(NOTE: I regret not doing something like this for the final project, which I worked on for a total of 160 hours over a 3-week period, all for a lousy mark of 77%)
Assignment 4: The Raytracer ---------------------------- 0-6 hours (26 Feb): - I started by soliciting advice from those who had already started the assignment. Found out the first thing to be done was to copy over the core files from Asmt 3, and modifying them. Tedious, but at least I was getting work done. HINT: Don't touch grsh.c if you don't have to. - Next I tried just getting something to show up on the screen. Random garbage. Whoops, forgot to initialize the pixel buffer. - Initialize the pixel buffer. I get an image, all right, but there's only one problem: every single pixel is black. Doh! I can't even raytrace a simple sphere, dammit. 7-12 hours (27 Feb): - Turns out my transformations are shooting me in the foot. Decided to go through the rest of this asmt without the assistance of OpenGL. Let the fun begin. I start modifying the transformation matrices myself. - Run program. Still get 500x500 image, pure black. - Ask for help and guy asks me how I am using my DAG. He asks me if I remembered to set the _inverse_ transformation matrices. (whoops) - Now I get a different image: the pixels on the left edge of the image are cyan-coloured. Finally, a step in the right direction! - Turns out my image was off-center because I had set up my virtual pixel screen incorrectly. (sigh) I finally get a sphere in my image. Getting one sphere took 12 hours. I need a coffee. 13-18 hours (28-29 Feb): - Next step: multiple spheres (oooh, aaah). Not too painful. - Next thing is lighting. I ask Tom for advice. "Remember that lighting equation in the course notes?", he asks. Uh oh. I was laughing off that equation in class, thinking we'd never actually have to use it. I'm not laughing anymore. - OK, I've set it up, but I'm still not getting anything. First problem: Matthias points out that I forgot to transform the lights into MCS. ARGH! - Transformed lights, but still don't have anything. I can't figure out what's going wrong. Desperate, I start filling my code with fprintf(stderr, ...) lines. Wait a minute, that point of impact isn't what it should be ... - Turns out I screwed up the parametric equation of the line joining the point of impact and the eye. This is something a high schooler could get right. I'm an idiot. 19-22 hours (01 Mar): - Well, today wasn't that painful. Got boxes done in just under 2 hours. Hmm, they're not really boxes, they're cubes, which makes life a lot simpler. - Guess it's time to do shadows. Didn't get anywhere. Some shadows were appeared, but others didn't. This can wait until tomorrow. I need some sleep. 23-32 hours (02 Mar): - Hmm, got a lot done before dinner. Turns out my shadow code for spheres AOK, but I had another bug somewhere which was screwing things up. - Got shadows for boxes and transformations working soon after. Woohoo! This isn't right, everything's gone great so far today ... 33-44 hours (03 Mar): - This was a bad day. Guess this pays back for yesterday. NOTHING worked. Couldn't figure out hierarchical transformations, and why you need to multiply by this stupid inverse transpose matrix. Even a wholesale rewrite of my DAG traversal code wasn't enough. - I'm tired and bitter. However I have the pleasure of knowing that I won't be the only one going down on this assignment. BWAHAHAHAHAHA!!!!! 45-48 hours (04 Mar): - Welcome to Saturday Night Live in MC 6055! We have a wonderful show planned for you this evening, so sit back and relax! If you like watching students suffer before your very eyes, we have just the thing for you! - I think fate is conspiring against me. Just as I was about to give up on this assignment, I found the bug which was impeding my progress.- Hence, I decided to get the rest of the easy stuff over with tonight. Finished instances and the pretty background in a matter of minutes. The last hurdle: polyhedra ... (yes Brad, this includes the dodecahedron) - Left lab at 4am. I'm starting to lose it. 49-54 hours (05 Mar): - All right, all of the objects actually show up in the correct spots now. Only problem: lighting and shadows no longer work. Why me? - The rest of the day was an exercise in futility. I'm ready to throw in the towel. 55-60 hours (06 Mar): - I didn't start working until 8pm. Next 3 hours were spent debugging the problem that arose on Sunday night. Finally, desperate, I ask for help. Dan asks, "Are you pre- or post-multiplying those transformation matrices?" I'm cynical. That couldn't possibly be the source of my problems, could it? Guess what. Hierarchies now work. I can't believe it. - Instances were still a problem, though: lighting and shading were completely off. I noted that even if I didn't fix this problem, I would still obtain an 8 or 9 out of 10 on the asmt. Conclusion? Bed Time! 61-68 hours (07 Mar): - The denouement. I didn't even try to get instances working. Most of the fellow coders in the lab were in disbelief. "Andrew, you can't give up now!", they said. Heh heh. :) - The only things remaining were the special feature and unique scene. Special feature? Supersampling with four rays. This was so easy it wasn't funny, and it ran correctly on my first try, too. Finally, something that went RIGHT on this asmt. Definitely the second easiest objective after that stupid "unique background" requirement. Now THAT was a joke. Downside: rendering now takes over 5 minutes. - I don't know how to explain this, but at this point I didn't care anymore. I don't think I've ever felt this cynical during my Ugrad career. I was going to finish the unique scene, do a half-assed job for the doc, and get a good night's sleep. I wouldn't even have bothered to fix the bug in my instance code had I found it at this point. At this point I am reminded of Alex Lee's memorable quote: "After a while, you just stop caring" - My unique scene is a rehash of hier.gr. But it _is_ different from everyone else's. If the TA's don't like it, they can kiss my @$$. - Finally, after 68 hours, I close the book on Assignment 4. The doc is finished and the checksum has been printed out. I walk out of the lab and there is a sense of emptiness, the sense that something is missing from my life, even a tinge of regret. Could it be? I'll miss you, my friend. EPILOGUE Next day in class (08 Mar): "Wow, everyone is wide awake! Oh well - if this assignment didn't get you, the project will do you in." -- Ian Bell, the instructor