Wednesday, March 12, 2008

First Place in Ray Tracing!

Our ray tracing class ended with a ray tracing competition that any student could optionally enter. The only requirement was our ray tracer had to implement at least two Monte-Carlo techniques. I chose to implement soft shadows using multiple samples on a light sphere and embossed reflections.

Although my ray tracer wasn't the most technically superior, it won the top $100 prize judged by an independent panel of professors. I will probably spend the money on groceries for next week...

Monday, April 23, 2007

Ray Tracing - Project 10

Design Choices

I decided to model a chess set for my image. All pieces in the scene are modeled with triangles except the board (a box) and the ominous red sphere. All the chess pieces were modeled using Blender by myself and exported to the OBJ format, for which I wrote a mesh parser.

The board is rendered using two different Perlin noises and rendered with soft shadows by displacing the light position using a spherical distribution and many samples per pixel. The chess pieces have the same two materials as the board, so I tried to place them on opposing colors so the Perlin noise wouldn't match up perfectly.

This project took me a long time (close to twenty hours, I imagine), mostly because I took so long trying to decide what scene I wanted. I decided to do a chess theme since it gave me a lot of control over how I wanted to lay it out, and I didn't want to do anything too terribly abstract (like a bunch of dragons staring at a heightfield). The final images took around 30 minutes to render using 25 samples per pixel.

Extra Credit

My second Monte Carlo effect was embossed reflections. This was added to materials using a Russian roulette method, where either the diffuse color or the reflected color would be calculated based on the ratio assigned between the two. The embossed reflections were generated by perturbing the normal over a uniform disk. The disk size determined the amount of blurriness.

I originally blended the two colors together, but that introduced a number of artifacts. Switching to the Russian roulette method, these dropped significantly, but I still see an occasional blue splotch. Also, the Russian roulette method looks horrible at low-sampling rates since every other pixel might have a different shading calculation.

This is my final rendered scene using soft shadows and embossed reflections. It took about forty minutes to run using 25 samples per pixel


Code:tracer.tar.bz2

Wednesday, April 11, 2007

Ray Tracing - Project 9

Design Choices

To implement instancing, I created an instance class inherited from the Primitive class. This allowed a simple abstraction for adding groups and other objects and stuff. The preprocess function called the grid layout preprocess for every instance so I added a check to only preprocess once. I used a matrix and a vector to hold the translations and rotations and created to functions for rotating and translating.

This is a really stupid picture of the Stanford bunny rotated and translated around in a strange manner showing the transformations possible with the new instance class


I was feeling patriotic and made a giant bunny flag and just gave it three different colors based on a series of modulos. I was really bored


Code: project9.tar.bz2'

Wednesday, March 28, 2007

Ray Tracing - Project 8

Design Choices

Most of the code modifications occurred in the Scene class. I chose to do this since it seemed logical that different scenes be rendered using different filters and samplings. Also, the Scene class is where the rays are created, so it was a simple change in code.

The code changes had two parts. One which allowed additional samples to be calculated at different points based on the filter, and another part of the code, which calculated the weight of each sampling. I chose the Gaussian filter to implement as it seemed simple and provide okay results, although not too much better then the actual triangle filter.

Rendered with 1 sample per pixel (no jittering)

The function provided in the homework assignment


A scene of random spheres and five different material types


Rendered with 9 samples per pixel with jittering and using the triangle filter

The function provided in the homework assignment



Rendered with 9 samples per pixel using a Gaussian filter


The function provided in the homework assignment


A scene of random spheres and five different material types


Code: project8.tar.bz2

Friday, March 16, 2007

Ray Tracing - Project 7

Design Choices

For the design of the texture mappers, I followed a scheme similar to the one Dr. Parker recommended. I created a TexCoordMapper that provided a basic interface for grabbing texture coordinates. The base object class--from which all primitives are descended--were given a default coordinate mapper, which could be changed through the API.

Besides the coordinate mappers, three new materials were created--a checker material(which used two sub-materials assigned to it), a marble material, which used Perlin noise, and a image material. All three materials were implemented exactly as described in the slides.

Required Image



Creative Image - Triceratops by Rainbow (and sphere)



Extra Credit

For extra credit, I chose to add an additional procedural texture (I'm shooting for half extra-credit). This material (shown in the creative image) allows spectrums of color to be display for effects like rainbows.

Code:http://www.cs.utah.edu/~jstratto/project7.tar.bz2

Wednesday, March 07, 2007

Ray Tracing - Project 6

Design Choices

I originally intended to do a BVH using an quad-tree, where the tree were recurse down to some arbitrary size. This gave me a strange bug (which I had to use for my original image). The algorithm itself seemed simple, but and for the small part of the bunny that it did render, it rendered rather quickly. Much faster than the 2.5 hour attempt without the acceleration structure.

I then tried a uniform grid, but had difficulty debugging it (I wasn't getting anything to the screen), mostly due the short amount of time I had left on the assignment.

I also tried a octree, which gave me similar results to the quad-tree, which makes me feel the bug lies somewhere in my bounding boxes or something.

Bugged Image-If you look really, really closely you can see the form of the bunny. From the part that rendered, it seemed to work effectively, but for everything else, it completely ignored it. It was probably something really small and I probably should have just debugged the quad-tree instead of attempting the other two


Required Image-Here's my final rendering. It took about 18 seconds, wihich was a lot faster than the 2.5 hour version.


Code:project6.tar.bz2

Saturday, February 24, 2007

Ray Tracing - Project 5

Design Choices

The three new material models were a dielectric, a phong, and a metal. All three shared specular properties so code was shared somewhat between them. All materials extended from a general material class which made used of extensive virtual functions to minimize the code base.

Required Image



Code:project5.tar