Assignment #3: Ray Tracing Images

Ray Generation

Two images with different half angles -- the image on the right has a half angle of 1, while the image on the left has a half angle of 0.5. Note that these images also match the ones on the example page. While I could show more images of various angles, the other images on this page serve to demonstrate that ray generation is handled correctly.

Ray Primitive Intersection

This image has every primitive object in it: box, sphere, mesh, cone, triangle, and cylinder. I removed all specular components of the materials so indirect specular illumination would not obscure the clear intersections. As with ray generation, all other images on this page demonstrate the correctness of these primitives.

Ray Scene Intersection / Modeling Transformations

Since intersecting correctly in a scene is tightly coupled to applying modeling transformations, I am combining these two features into one section. The image on the left is from the hierarchy.scn scene file, which contains several nested transformations. The output matches the examples given to us. The image on the right is a slightly modified version of transform.scn (an additional light was added to prevent shadows from being cast on the spheres). Again, this scene file has multiple transformations and multiple primitives in it, each one applied successfully.

Phong Lighting

Three different images demonstrate various Phong lighting effects. The leftmost image is the lights.scn example file, which looks the same as the one in the examples page. The middle image is the transform.scn file with an additional light to prevent shadows from obscuring the lighting effects. The rightmost image is of three cubes. Two spot lights are focused in front of the left and right cubes, as well as a point light for the middle cube. A soft, directional light also exists and gives a bit more highlight to the image. Together, these images demonstrate all three types of light sources in Phong Lighting.

Shadows and Specular Reflection

The leftmost image is generated from the dinopet_reflect.scn file. An additional spot light was added to provide a "soft shadow" behind the dinosaur, while a strong shadow is directly below it. I slightly modified it so dinosaur was not very reflective, while the surface was, and I added a spot light above the camera and above the dinosaur, to provide more illumination and an additional, light shadow behind the dinosaur. The dinosaur's reflection can be seen in the surface, and a bit of the surface's color reflects off of the dinosaur. The rightmost image is a view of the dinopet from up top. The shadow beneath it is quite clear.

Motion Blur

The image on the left is of two cubes, one close to the camera, and one further away. The image on the right is the motion blur of it. Note that parallax effect, as the cube further away appears less blurred. To simulate motion blur, the camera is moved over 20 time steps and in the direction of the offset. The number 20 was chosen as it can produce believable motion blurs for small changes and is not very computationally intensive. If medium or large time steps are desired, a larger number is needed. Since the specification says that motion blur only takes the offset as an argument, I made a compromise to do the best possible blur in a "reasonable" amount of time.

Camera Antialiasing

The image on the left is of the dinopet being reflected, while the image on the right is the dinopet being reflected, but super-sampled and combine with a box filter of width 4. Jaggies are clearly lessened. The blurring effect occurs since the box filter performs an average over every set of 4 pixels, and (in this particular case) 4 pixels cover a significant area of the image.

Reconstruction Filters

I implemented six different reconstruction filers. They are listed below in the following order: Box, Gaussian, Lanczos, Mitchell, Catmull-Rom, and Cubic B-Spline. They all do a good job of removing jaggies and other alias artifacts. The Box filter is the most blurry, as the filter width is decently large for such a small image. The Gaussian filter can better handle this situation, as it puts more weight on rays that are close to the pixel. The Lanczos filter is very sharp, and is due to the fact that the filter sometimes subtracts neighboring values (which applies a moderate sharpen filter). However, it does cause some stark edge detection near the horizon. Mitchell, Catmull-Rom, and cubic B-Spline are all quite similar (in fact, the Mitchell filter is a linear interpolation of Catmull-Rom and cubic B-Spline). While Catmull-Rom is sharp, it also has a slight problem with stark contrast between edges. The cubic B-spline is slightly more fuzzy, but with less contrast. Mitchell is a nice blend between them.

Box

Gaussian

Lanczos

Mitchell

Catmull-Rom

Cubic B-Spline

Distributed Ray Tracing

The image is of two diffuse surfaces. On the left, we have specular recursion as specified earlier. On the right, we use distributed ray tracing to re-construct diffusive light. Note that it has more light contribution from the diffusive rays. Since the distributed ray tracer samples random rays, using few rays results in artifacts (since the estimate of the light integral is inaccurate). The image in the middle was rendered with 10 rays per intersection, and the image on the right was rendered with 30 rays per intersection. Using even more rays significantly reduces discrepancies in this Monte Carlo integration, but increases the computation time significantly. I used 30 rays as a maximum so this test script would run in a reasonable amount of time.