cs184 final project report: monte carlo path traceryglee/website_01242011/cs184_final_… · cs184...

12
CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV) 1. Introduction We implemented a basic Monte Carlo global illumination rendering system using path tracing. Our path tracer is an extension of the basic ray tracer from assignment 4. Unlike the ray tracer, Monte Carlo Path Tracer handles interreflections between surfaces with arbitrary BRDFs (Bidirectional Reflectance Distribution Function) by picking a random direction for each reflection or refraction ray. It uses importance sampling by weighting the random direction using the BRDFs. 2. Basic Features Our path tracer has following features: Ability to path trace diffuse, glossy, reflective surfaces Diffuse Interreflections (i.e. color bleeding) Area Lights Indirect Lighting (i.e. soft shadows) Russian Roulette early termination method to increase efficiency Uniform, Rejection, Importance Sampling for both Lambertian and Phong Surfaces Ambient Occlusion Depth of Field Environment Mapping These features are carry-overs from the ray tracer: Axis Aligned Bounding Box Antialiasing via Jittered Rays Refraction 3. Difficulties Encountered 3.1. BRDF and PDF calculation. Implementing importance sampling was tricky be- cause it was hard to generate the correct values for BRDF and PDF to multiply the value returned by the sampled ray. We ended up following the method outlined in CS294-13 lecture notes. But we re-wrote importance sampling twice following a method from PBRT and another method from the SIGGRAPH paper (see references). Both generated images that were almost correct but it was hard to tell which part of weighting calculation was making the image slightly off. 1

Upload: others

Post on 10-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

CS184 FINAL PROJECT REPORT:

MONTE CARLO PATH TRACER

CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

1. Introduction

We implemented a basic Monte Carlo global illumination rendering system using pathtracing. Our path tracer is an extension of the basic ray tracer from assignment 4. Unlikethe ray tracer, Monte Carlo Path Tracer handles interreflections between surfaces witharbitrary BRDFs (Bidirectional Reflectance Distribution Function) by picking a randomdirection for each reflection or refraction ray. It uses importance sampling by weightingthe random direction using the BRDFs.

2. Basic Features

Our path tracer has following features:

• Ability to path trace diffuse, glossy, reflective surfaces• Diffuse Interreflections (i.e. color bleeding)• Area Lights• Indirect Lighting (i.e. soft shadows)• Russian Roulette early termination method to increase efficiency• Uniform, Rejection, Importance Sampling for both Lambertian and Phong Surfaces• Ambient Occlusion• Depth of Field• Environment Mapping

These features are carry-overs from the ray tracer:

• Axis Aligned Bounding Box• Antialiasing via Jittered Rays• Refraction

3. Difficulties Encountered

3.1. BRDF and PDF calculation. Implementing importance sampling was tricky be-cause it was hard to generate the correct values for BRDF and PDF to multiply the valuereturned by the sampled ray. We ended up following the method outlined in CS294-13lecture notes. But we re-wrote importance sampling twice following a method from PBRTand another method from the SIGGRAPH paper (see references). Both generated imagesthat were almost correct but it was hard to tell which part of weighting calculation wasmaking the image slightly off.

1

Page 2: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

2 CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

3.2. Area Light Sampling. For a long time, our area light implementation didn’t lookquite right because we weren’t weighting its samples correctly. Once we accounted for thecosine theta term, the images became more realistic.

3.3. Time and Machine Limitations. Due to finite amount of time and limitations ofour personal computers, we were unable to generate very smooth images. We had to waitfor the render to finish for each debugging session. Smaller test images were suggestedbut it was generally hard to tell the correctness of the image using smaller test input filesbecause the difference between incorrect and correct (or improved) path traced image isvery subtle.

Page 3: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER 3

4. Results

4.1.Key Feature: Color Bleeding, Soft Shadow, Russian Roulette

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheres, a mirrored sphere, and a specular sphere.Render Time: 33 minutesNumber of Rays Per Pixel: 750Note: With Russian Roulette, this image takes 33 minutes to render. Without RussianRoulette, the render time goes up to 90 minutes.

Page 4: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

4 CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

4.2.Key Feature: Color Bleeding, Soft Shadow

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheresRender Time: 50 minutesSamples Per Pixel: 1000Note: Shows Color bleeding quite clearly, and indirect lighting in the shadows (note thatthere is one light source and no ambient terms, so the color in the shadows is all fromglobal illumination).

Page 5: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER 5

4.3.Key Feature: Depth of Field

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheres, a mirrored sphere, and a specular sphere.Render Time: 35 minutesSamples Per Pixel: 750Note: Notice that lower right sphere is in focus while other are not.

Page 6: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

6 CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

4.4.Key Feature: Depth of Field

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheresRender Time: 35 minutesSamples Per Pixel: 750Note: Focused on the right sphere.

Page 7: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER 7

4.5.Key Feature: Indirect Lighting

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two Diffuse SpheresRender Time: 31 minutesSamples Rays Per Pixel: 750Note: You can also see indirect lighting on the shadowed pedestal here too, which is sig-nificant because that’s two bounces of indirect lighting (non-shadowed pedestal, to sphere,to pedestal in shadow). The pedestal is intentionally partly blue.

Page 8: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

8 CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

4.6.Key Feature: Ambient Occlusion

Sampling Method: Uniform SamplingRussian Roulette: OffRender Time: 60 minutesSamples Per Pixel: 750Note: We followed an irradiance calculation in ambient occlusion setting by Cook andTorrance [ref 1, page 373].Ambient Occlusion value: kA(p) = 1/π

∫v(p, l)cos(θi)dwi Ambient Irradiance: E(p, n) =

kA(p)πLA

Page 9: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER 9

4.7.Key Feature: Environment Mapping

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheres and a mirrored sphereRender Time: 35 minutesSamples Per Pixel: 500Note: One light source to simulate sun overhead (visible in reflection). Much indirectlighting from the environment.

Page 10: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

10 CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

4.8.Key Feature: Environment Mapping

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheres and a mirrored sphereRender Time: 30 minutesSamples Per Pixel: 500Note: Same scene as previous but different environment. Note the different sphere colors(orangeish instead of bluish). This is purely due to the different environment.

Page 11: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER 11

4.9.Key Feature: Environment Mapping

Sampling Method: Importance SamplingRussian Roulette: OnObjects: Two diffuse spheres and a mirrored sphereRender Time: 31 minutesSamples Per Pixel: 500Note: Again, just a different environment.

Page 12: CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACERyglee/website_01242011/cs184_final_… · CS184 FINAL PROJECT REPORT: MONTE CARLO PATH TRACER CONOR HUGHES (CS184-CK) AND YEON JIN

12 CONOR HUGHES (CS184-CK) AND YEON JIN LEE (CS184-AV)

5. References

1. Akenine-Moller, Haines, Hoffman. 2008. Real Time Rendering, Third Edition.2. Pharr, Humphreys. 2010. Physically Based Rendering. Second Edition.3. Shirley, Marschner. 2009. Fundamentals of Computer Graphics.4. O’Brien, Ravi Ramamoorthi. ”Lecture 2: Monte Carlo Path Tracing” Fall 2009.5. O’Brien, Ravi Ramamoorthi. ”Lecture 5: Illumination and Reflection” Fall 2009.6. ”State of the Art in Monte Carlo Ray Tracing for Realistic Image Synthesis.”

SIGGRAPH 2001 Course29.7. Agrawala. ”Lecture 18: Global Illumination” Fall 2010.