CS 488 Ray Tracer Project

Objective 1: New Primitives

I added two new primitives: cylinders and cones.

Cylinder and Cone Sample Image

Objective 2: Constructive Solid Geometry (CSG)

First row: difference

Second row: union and two differences on the same primitive

Third row: intersection

CSG Sample Image

Objective 3: Texture Mapping

Texture Mapping Sample Image

Objective 4: Refraction

Refraction Sample Image

Objective 5: Soft Shadows

Soft Shadows Sample Image

Objective 6: Reflection

Reflection Sample Image

Objective 7: Perlin Noise

Perlin Sample Image

Objective 8: Depth of Field

Depth of Field Sample Image

Objective 9: Uniform Spatial Subdivision

Results for 8 threads and 4096 voxels (on the macho cows scene):

With no optimizations No subdivision, with bounding boxes With subdivision, with bounding boxes
Real > 2m45.648s 0m46.611s 0m33.821s
User > 20m27.353s 3m5.321s 2m8.716s
Sys > 0m2.371s 0m0.365s 0m0.170s

We can see that subdivision provides roughly a 40% increase in speed.

Objective 10: Final Scene

Final Scene

Bonus Feature: Multithreaded Rendering

n is the number of threads (Tests performed on a quad-core early 2013 Macbook Pro)

n=1 n=4 n=8 n=16 n=32
Real 1m55.321s 1m5.880s 0m40.337s 0m32.612s 0m30.009s
User 1m55.245s 2m4.765s 2m34.474s 3m17.845s 3m43.431s
Sys 0m0.071s 0m0.089s 0m0.180s 0m1.181s 0m1.191s

We can see that the effective real time decreases as we increase threads, with no significant gain around 16 threads.