Ray Tracer

February 22nd, 2010 Leave a comment Go to comments

CG II: Ray Tracer

Goal:

I will be recreating the scene in Figure 1 using ray tracing.

original

Figure 1: Ray trace Scene (Turner Whitted)

Part 1: Setting up the Scene (setup code)

OpenGL Scene

Figure 2: Sample Scene rendered in OpenGL with GLUT

This scene was used to get the positional parameters for the ray tracer which are given here.

Part 2: Ray Tracing

Figure 3: Ray Traced Render

I was able to use some of the scene parameters that I had gathered from my OpenGL test program, but my coordinate system is different from OpenGL. I had to flip the X coordinate values and I fixed the objects so that they didn’t intersect with the film plane or the floor.

Bonus: Multi-Sampling

Figure 4: A Multi-Sampled Render

I added functionality to multi-sample a scene using recursion. Each pass will generate create 4 times as many rays per pixel. The image above was generated with 3 sample passes, translating into 64 samples per pixel. The 64 samples return color values which are averaged together to create an accurate color value for the pixel. Multi-sampling produces the effect of anti-aliasing an image which reduces the jaggies.

Part 3: Phong Shading and Shadow Rays

Figure 5: Shadows

Light Perspective

Figure 6: A view from the light position (anything blocked is in a shadow)

Figure 7: Phong Shading!

Check out the different forms of phong shading components Phong Shading Components

Part 4: Procedural Shading

Figure 8: Procedural Shading and Phong

For the floor in this part of the project I implemented a procedural texture. A procedural texture is calculated at runtime instead of using an image for the floor.

Part 5: Reflection

Part 6: Refraction

Figure 13: First refraction image

Figure 14: Fixed phong shading and 5x multisampling (2048 rays per pixel)

Part 7: Tone Reproduction

Figure 15: Unaltered reference image (no tone reproduction)

The following images use tone mapping to bring the color values from a high dynamic range down to a low dynamic range of colors which can be displayed on a low dynmaic range device such as a computer monitor. I use two types of global tone reproduction. One is from Greg Ward and the other is from Erik Reinhard.

Ldmax = 100, Lmax Varies in each set of images

Figure 16: Ward 1 nit / Reinhard 1 nit

Figure 17: Ward 10 nits / Reinhard 10 nits

Figure 18: Ward 100 nits / Reinhard 100 nits

Figure 19: Ward 1000 nits / Reinhard 1000 nits

Figure 20: Ward 10000 nits / Reinhard 10000 nits

Bonus: Reinhard Luminance Values Changed

Lmax = 1, Ldmax = 100

Figure 21: Reinhard using the luminance from pixel (10, 10) as the key value

Figure 22: Using the lumiance 0.15 as the key value

Bonuses:

Transmission Shadows:

Figure 23: Lighter Shadows for trasmissive objects.

Phong-Blinn vs Phong Shading:

Figure 24: Phong-Blinn shading on the left and Phong on the right. Exponent = 20.0 for both.


Back

  1. No comments yet.
  1. No trackbacks yet.