CS 6620 Advanced Computer Graphics II - Assignment 3

Zach Gildersleeve
February 7, 2007

Required Image

Here is the required image, as produced by the program. It took on average 5.6 seconds to render.

required3.ppm

The triangle's normal is the planar normal, where N = (p1 - p3) X (p2 - p3), rather than the normal interpolated across the triangle's face.

Code Listing

The code for this image can be found here.

Design Choices

This assignment builds on the previous assignment. The Disc and Ring classes are straightforward improvements on the Plane class, bounded by a single radius for the Disc, and two radii for the Ring. The Triangle is created by identifying the three corner points. Two of the three edges are found, as is the normal following the above equation. The Triangle implementation sets up a barycentric coordinate system, and checks for intersections with the ray in the range (0.0, 1.0). The Box intersection follows the algorithm identified by Williams, et. al. in "An Efficient and Robust Ray-Box Intersection Algorithm." Assuming the Box is axis aligned (which it is), the bounding t values are found, and the min and max ray t values are identified. After a check to determine if the camera is inside the Box, the t value is passed to the HitRecord. Other relevant design choices include an updated render viewer, that draws to an OpenGL window using Points rather than Pixels, thus allowing for better non-linear accessing of the pixel data and a faster display time. The main function creates a Scene, calls the make_scene() in a header file which populates the scene, and then returns control to the main function to preprocess and start rendering. The render() function in Scene is overloaded to either render the entire frame (i.e. the pixel double for loops are inside the function) or one pixel at a time. To complement this the Image::set() function, which sets a Color and coordinate to a pixel and clamped color value, is overloaded as well.

Creative Image

For my creative image, I built a spaceship that has almost completed its raytraced voyage to Saturn. I implemented a starfield background for this scene. This image took approxamently 26 seconds on the same system as the required image above.

creative2.ppm

Extra Credit

 

Additional Comments

This assignment was met with much more ease compared to the previous assignment. The required image took me about 15 hours, with the bulk of that time working on the box. The creative image only took about 2 hours to code once the box was completely working.