Final Project Report
CSS 552 – Prof. Sung
Jessica Ho and Duncan MacMichael
March 14, 2016

Contents

Problem Statement

The Phong Illumination Model and ray tracing engine explored thus far are flexible in the kinds of illumination they can simulate, but are only part of a larger formula for producing photorealistic ray traced images. Part of the reason that basic ray tracing looks fake are because of “jagged edges, hard shadows, everything is in focus, objects are completely still, surfaces are perfectly shiny, and glass is perfectly clear” (Hart, p. 2) [1]. Depth of Field is needed as one way to enhance realism. In real life, cameras and our eyes filter light through a lens and control the amount of light allowed onto the image plane (image sensor or retina), which, according to Demers (2004) [6], causes some items to appear out of focus depending on their distance from the focal plane and the projection. Default 3D camera model does not replicate true camera functionality (such as controllable focal distance and aperture), meaning the image is rendered in perfect focus and the viewer immediately realizes that the image is computer-generated. Our current camera does provide focal distance but is not configurable by the user (“Focal Distance = Length(lookAtPoint – eyePoint)” (Harvey, 2012) [7]).

Solutions

Three general approaches to solving depth of field:

  1. Shoot additional rays at runtime and average samples (Lee, 2007) [4]
  2. Physically accurate DoF via multiple renders (IneQuation, 2012) [3]
  3. Use Z-Buffer (depth information) to post-process DoF (Yu, 2004) [10]
See the references section for a full citation and further reading.

For our CSS 552 final project, we implemented Z-Buffer as a post process. Below are our results.

Results

The results shown below were not able to fully achieve the fully desired results. The main obstacle we were not able to overcome was comparing the CoC to a reasonable "pixel size" based on the scene dimensions, which would have enabled varying blur throughout the image based on how close the objects were. Providing various values for CoC calculation via aperature, focal distance, and len distance, the results showed varying levels of success and were highly dependent upon relativity to one another. Below is a sampling of the results we were able to obtain and their settings.

Result 1

Blurring on the outer edges of the image is seen in particular along the checkered pattern of the image. This illustrates an exceedingly large CoC due to the controls we used.

Original Blurred Settings

Result 2

Having the values set below, gave the illusion that the CoC was being calculated correctly and that the darker area was in focus, however, this is not the case. The CoC of the darker area below is still out of focus. This effect was achieved with non-realistic lens distance and focal distance values.

Original Blurred Settings

Result 3

The entirety of the image is blurred with a large aperture. This is true to life where large apertures cause anything far away from the camera to be very blurred.

Original Blurred Settings

References

  1. Hart, J. C. (n.d.). Distributed Ray Tracing. Retrieved February/March, 2016, from http://luthuli.cs.uiuc.edu/~daf/courses/computergraphics/week3/distributed-final.pdf
  2. Distribution raytracing. (n.d.). Retrieved February/March, 2016, from http://www.cs.unc.edu/~jpool/COMP870/Assignment2/
  3. IneQuation (2012, April 04). How to implement Depth of Field in Ray Tracer? Retrieved February/March, 2016, from http://stackoverflow.com/questions/10012219/how-to-implement-depth-of-field-in-ray-tracer
  4. Lee, Skeel (2007, March). CG:Skeelogy - Depth Of Field Using Raytracing. Retrieved February/March, 2016, from http://cg.skeelogy.com/depth-of-field-using-raytracing/
  5. Hammon, E., Jr. (2004). GPU Gems 3 - Chapter 28. Practical Post-Process Depth of Field. Retrieved February/March, 2016, from http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html
  6. Demers, J. (2004). GPU Gems - Chapter 23. Depth of Field: A Survey of Techniques. Retrieved February/March, 2016, from http://http.developer.nvidia.com/GPUGems/gpugems_ch23.html
  7. Harvey, S. (2012, December 21). Ray Tracer Part Six – Depth Of Field. Retrieved February/March, 2016, from https://steveharveynz.wordpress.com/2012/12/21/ray-tracer-part-5-depth-of-field/
  8. Depth of Field (ray tracing) - Graphics Programming and Theory. (2005, October 19). Retrieved February/March, 2016, from http://www.gamedev.net/topic/352850-depth-of-field-ray-tracing/
  9. Barsky, B. A., & Kosloff, T. J. (n.d.). Algorithms for Rendering Depth of Field Effects in Computer Graphics. Retrieved February/March, 2016, from http://zach.in.tu-clausthal.de/teaching/cg_literatur/Rendering Depth of Field Effects Survey.pdf
  10. Yu, T. (2004). Depth of Field Implementation with OpenGL. Retrieved February/March, 2016, from http://www.cs.mtu.edu/~shene/PUBLICATIONS/2004/CCSC-MW-2004-depth_of_field.pdf