COMP 870 - Assignment 1

 


Aims | Current state | Simulation results and Discussion | Source code and binaries | References | email: golas at cs dot unc dot edu |


Aims:
This assignment had the following aims:

Top


Current state:

I’ve built a basic ray tracer with the following features

Ray Tracer structure:

The ray tracer is based on OOP. There are primarily 4 classes:

These classes are combined by different classes. The class Scene combines all objects and lights. The primary class Apollo contains the Scene, Camera and contains an XML based parser. The implementation also uses a rudimentary math library which contains implementations of 3-dimensional points and rays.

Image Rendering Flow:

algorithm generaterays {
          Using camera and sampler, generate rays
          foreach ray {
                   shootray and collect color value
          }
          use reconstruction filter to collate the value at pixel
}

algorithm shootray {
          find nearest object the ray hits
          if an intersection occurs
          {
                   find color at point using object’s shader and shoot shadow/light rays -> ambient component + diffuse and specular components from all visible lights
                   recurse and shoot reflected and transmitted rays with contribution scaled by reflectivity
          }
}

Other Comments:

Currently rays are shot sequentially, in further assignments, I aim to construct a ray queue and shoot blocks of rays and use SMP to parallelize and speed up computation. I also aim to add other shading models and texture mapping support.

Top


Simulation results and Discussion:

 

Image 1                                              Image 2                                              Image 3                                             Image 4

Among sampling techniques, I have implemented the following samplers:

 

The number of samples per pixel can be set by the user. For the current examples, it has been set to 9 samples per pixel.

 

Among reconstruction filters, I have implemented the following:

 

For measuring the performance of different filters, a base image was rendered the scene using 81 samples per pixel with a box filter and uniform sampling, and difference images are used to rate the different sampler-filter pairs.

 

Rendered Images:

Sampler\Filter

Box

Tent

Gaussian

Mitchell-Netravali

Uniform

Jittered

N-rooks

Hammersley

 

Difference Images:

Sampler\Filter

Box

Tent

Gaussian

Mitchell-Netravali

Uniform

Jittered

N-rooks

Hammersley

 

Comparison among samplers:

 

Amongst all samplers, the Hammersley sequence has most pronounced differences with the base image. In addition to expected differences along object edges, there are noticeable differences inside the shaded object, the effect being most pronounced when using a tent filter. It seems apparent that the quasi-random sequence is introducing its own patters into the rendered image. However, it enhances the sharper features in the image by reducing the pixelation of edges which outweighs the problem of noisy patterns especially when used with a Gaussian or Mitchell-Netravali filter.

 

The N-rooks and uniform sampling strategies give similar performance in terms of image quality. However, since the n-rooks method used noise, it reduces the pixelation of edges, but at the cost of introducing certain noise into the image. The Jittered sampling scheme gives combines the best of both as it enhances edges without introducing exceedingly spurious noise. It reduces edge pixelation with less of noise artifacts.

 

Comparison among filters:

 

Among the filters, the Gaussian filter gives smoother results than either the tent or the Mitchell-Netravali filters. However, in the example taken, the Box and Gaussian filters give almost exact results visually, which is an unexpected result. The tent filter gives patterns when used with Hammersley sampling which suggests that the dominant frequencies of the sequence are enhanced by the filter. Overall, the Gaussian filter gives the best results when used with such random or pseudo-random sequences as it nullifies the high frequency noise usually induced by such sampling, while not causing any ringing effects introduced by other filters (like truncated sinc).

 

The images used to generate the difference images above can be found here, while the full resolution difference images can be found here. Some other sample images are also located here.

Top


Source code and binaries:

Top


References:

Top


Site last updated: Monday, September 8, 2008 12:00 AM