Monte Carlo Path Tracing



Similar documents
CSE168 Computer Graphics II, Rendering. Spring 2006 Matthias Zwicker

Path Tracing. Michael Doggett Department of Computer Science Lund university Michael Doggett

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

An introduction to Global Illumination. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Advanced Computer Graphics. Rendering Equation. Matthias Teschner. Computer Science Department University of Freiburg

PHOTON mapping is a practical approach for computing global illumination within complex

path tracing computer graphics path tracing 2009 fabio pellacini 1

Monte Carlo Path Tracing

PATH TRACING: A NON-BIASED SOLUTION TO THE RENDERING EQUATION

Path tracing everything. D.A. Forsyth

Chapter 10. Bidirectional Path Tracing

CS 431/636 Advanced Rendering Techniques"

Rendering Area Sources D.A. Forsyth

Specular reflection. Dielectrics and Distribution in Ray Tracing. Snell s Law. Ray tracing dielectrics

Mathematics for Global Illumination

Monte Carlo Ray Tracing

The RADIANCE Lighting Simulation and Rendering System

How To Improve Efficiency In Ray Tracing

Deferred Shading & Screen Space Effects

Dhiren Bhatia Carnegie Mellon University

Volumetric Path Tracing

Path Tracing Overview

CUBE-MAP DATA STRUCTURE FOR INTERACTIVE GLOBAL ILLUMINATION COMPUTATION IN DYNAMIC DIFFUSE ENVIRONMENTS

INTRODUCTION TO RENDERING TECHNIQUES

A Ray Tracing Solution for Diffuse Interreflection

Computer Animation: Art, Science and Criticism

IN previous chapters we assumed that all lighting interactions occurred at surfaces. In particular,

Thea Omni Light. Thea Spot Light. Light setup & Optimization

A Theoretical Framework for Physically Based Rendering

Accelerating the bidirectional path tracing algorithm using a dedicated intersection processor

Improved predictive modeling of white LEDs with accurate luminescence simulation and practical inputs

Lezione 4: Grafica 3D*(II)

Introduction to Computer Graphics

Bildverarbeitung und Mustererkennung Image Processing and Pattern Recognition

Photon Mapping Made Easy

Acceleration Methods for Ray Tracing based Global Illumination

Path Tracing - Literature Research. Rick de Bruijne May 17, 2011

Reflectance Characteristics of Accuflect Light Reflecting Ceramic

Lighting Estimation in Indoor Environments from Low-Quality Images

Convention Paper Presented at the 118th Convention 2005 May Barcelona, Spain

Outdoor beam tracing over undulating terrain

Efficient Implementation of Bi-directional Path Tracer on GPU

Efficient Illumination by High Dynamic Range Images

A Short Introduction to Computer Graphics

Chapter 23. The Reflection of Light: Mirrors

Sensor Modeling for a Walking Robot Simulation. 1 Introduction

Monte Carlo Sampling Methods

ABS 731 Lighting Design & Technology. Spring 2006

CS3220 Lecture Notes: QR factorization and orthogonal transformations

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

The Photosynth Photography Guide

Using visible SNR (vsnr) to compare image quality of pixel binning and digital resizing

SkillsUSA 2014 Contest Projects 3-D Visualization and Animation

Advanced Topics in Source Modeling

Practice Final Math 122 Spring 12 Instructor: Jeff Lang

REAL-TIME IMAGE BASED LIGHTING FOR OUTDOOR AUGMENTED REALITY UNDER DYNAMICALLY CHANGING ILLUMINATION CONDITIONS

SHOW MORE SELL MORE. Top tips for taking great photos

GRADES 7, 8, AND 9 BIG IDEAS

Introduction to Medical Imaging. Lecture 11: Cone-Beam CT Theory. Introduction. Available cone-beam reconstruction methods: Our discussion:

Mean-Shift Tracking with Random Sampling

Cork Education and Training Board. Programme Module for. 3 Dimensional Computer Graphics. Leading to. Level 5 FETAC

Chapter 4 Variance Reduction Techniques

DYNAMIC RANGE IMPROVEMENT THROUGH MULTIPLE EXPOSURES. Mark A. Robertson, Sean Borman, and Robert L. Stevenson

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

13. Write the decimal approximation of 9,000,001 9,000,000, rounded to three significant

High Quality Image Magnification using Cross-Scale Self-Similarity

WHITE PAPER. Source Modeling for Illumination Design. Zemax A Radiant Zemax Company

Hunting Ghosts. For the development of imaging optical STRAY LIGHT ANALYSIS IN IMAGING OPTICS

CS 371 Project 5: Midterm Meta-Specification

NEW MEXICO Grade 6 MATHEMATICS STANDARDS

CS408 Animation Software Design Sample Exam Questions (Second Half)

Teaching Introductory Computer Graphics Via Ray Tracing

MCRT: L6. Initial weight of packet: W = L / N MC At each interaction multiply weight by probability of scattering: W = a W

Fast and Robust Normal Estimation for Point Clouds with Sharp Features

High-resolution Imaging System for Omnidirectional Illuminant Estimation

Reflection and Refraction

Optical Design Tools for Backlight Displays

Experiment #1, Analyze Data using Excel, Calculator and Graphs.

Algebra Academic Content Standards Grade Eight and Grade Nine Ohio. Grade Eight. Number, Number Sense and Operations Standard

Animation (-4, -2, 0 ) + (( 2, 6, -4 ) - (-4, -2, 0 ))*.75 = (-4, -2, 0 ) + ( 6, 8, -4)*.75 = (.5, 4, -3 ).

Getting Started with iray in 3ds Max 2014

Physics 202 Problems - Week 8 Worked Problems Chapter 25: 7, 23, 36, 62, 72

Lesson 26: Reflection & Mirror Diagrams

How To Analyze Ball Blur On A Ball Image

VARIANCE REDUCTION TECHNIQUES FOR IMPLICIT MONTE CARLO SIMULATIONS

CS 4620 Practicum Programming Assignment 6 Animation

Hidden Markov Models

CS 534: Computer Vision 3D Model-based recognition

Epipolar Geometry. Readings: See Sections 10.1 and 15.6 of Forsyth and Ponce. Right Image. Left Image. e(p ) Epipolar Lines. e(q ) q R.

Part 4 fitting with energy loss and multiple scattering non gaussian uncertainties outliers

Treasure Hunt. Lecture 2 How does Light Interact with the Environment? EMR Principles and Properties. EMR and Remote Sensing

KEANSBURG SCHOOL DISTRICT KEANSBURG HIGH SCHOOL Mathematics Department. HSPA 10 Curriculum. September 2007

Power Electronics. Prof. K. Gopakumar. Centre for Electronics Design and Technology. Indian Institute of Science, Bangalore.

Robotics. Lecture 3: Sensors. See course website for up to date information.

Exam 1 Sample Question SOLUTIONS. y = 2x

GRAFICA - A COMPUTER GRAPHICS TEACHING ASSISTANT. Andreas Savva, George Ioannou, Vasso Stylianou, and George Portides, University of Nicosia Cyprus

To determine vertical angular frequency, we need to express vertical viewing angle in terms of and. 2tan. (degree). (1 pt)

Adding Animation With Cinema 4D XL

Light Control and Efficacy using Light Guides and Diffusers

What mathematical optimization can, and cannot, do for biologists. Steven Kelk Department of Knowledge Engineering (DKE) Maastricht University, NL

Transcription:

CS294-13: Advanced Computer Graphics Lecture #5 University of California, Berkeley Wednesday, 23 September 29 Monte Carlo Path Tracing Lecture #5: Wednesday, 16 September 29 Lecturer: Ravi Ramamoorthi Scribe: Mason Smith 1 Motivation The rendering equation, given in the previous lectures, provides a theoretical solution for computing the radiance at any point in the scene. However, direct analytic computation of the integral is intractable for anything besides the most trivial of scenes. Monte Carlo path tracing is a practical general solution to the rendering problem, which tries to enumerate all light paths in the scene. As we shall see later, in a standard practical implementation, we perform direct and indirect sampling separately. Last class, we talked about breaking up the rendering equation integral by object. We can further decompose the integral based on object types (indirectly illuminated, light source, etc.) Figure 1: In both of these path tracing examples, 1 paths were used per pixel. Notice how the second example is much more noisy, due to the specular brdfs used for the spheres. 1.1 Advantages and Disadvantages Many of the advantages of Monte Carlo path tracing (MCPT) come from its generality. MCPT is capaable of rendering any type of geometry, with any BRDF.

2 CS294-13: Lecture #5 Figure 2: Examples from the arnold renderer Furthermore, MCPT takes into account all types of light paths. We can enumerate light paths using regular expression notation. If we let S and D represent specular and diffuse surfaces and we let L and E represent the light and the camera eye repsectively, then we note that MCPT can handle all light paths L(S D) E. By contrast, Whitted ray tracing cannot handle diffuse-diffuse reflections of the form LDDD E, and radiosity does not handle specular reflections, e.g. of the form LDSS E. MCPT has other advantages. Basic MCPT is an unbiased algorithm. Recall that T (X) is an unbiased estimator of X if E[T (X)] = X. Thus, error in the image appears as noise do the the variance of the sample estimates, rather than less visually-appealing structured artifacts. The main disadvantage to MCPT is its speed. The final result converges only in Θ(n), where n is the number of samples used in the approxmation. We can use various approaches to try to decrease the variance in the image or increase the speed of the algorithm, but these extensions often sacrificed the unbiased nature of the algorithm. 2 Monte Carlo Path Tracing In MCPT, we integrate the radiance for each pixel by randomly sampling paths and computing the radiance along those paths. We use the samples as an estimate for the radiance.

CS294-13: Lecture #5 3 2.1 Simple Implementation Here we present a (very) naïve implementation of MCPT. for all pixels p do Cast n samples within pixel square and average pixel color+= 1 T racep ath(p, d) n end for T racep ath(p, d) : BEGIN Find nearest intersection p if Emitted then { The extra factor of 2 comes from the probability 1 reweighting. } 2 return 2 L emit else if Reflected then Generate ray in random direction d return 2 f r (d d ) (n d ) T racep ath(p, d ) end if END This implementation is naïve in a number of ways. First, this method essentially doesn t support point-light sources. Since the probability of choosing a random direction point directly at a point light is essentially, we would never record any contribution from these lights. Furthermore, this method wastes a large number of rays. For instance, for nonemissive objects in the scene, we waste 5% of the the rays by returning no luminance. We want to improve efficiency, ideally without introducing bias. For this, we rely on some of the variance reduction techinques discussed in previous lectures. 3 Variance Reduction 3.1 Importance Sampling In many scenes, certain areas contribute more to the scene than others. For instance, direct lighting on an object typically contributes much more to the observed radiance than indirect lighting, whenever direct lighting is present. Similarly, output angles with a higher BRDF, given the incoming angles, will contribute more to the radiance at a point on a surface. As an extreme example, consider a perfectly specular mirror. For a given incoming direction, all of the radiance is contributed by exactly one outgoing direction. Even taking a thousand samples will likely yield no contribution, compared to just one sample in the ideal direction. Importance sampling uses this phenomenon to our advantage. With importance sampling, we bias our sample paths towards those where we expect a larger contribution. This can occur in two ways, as outlined above:

4 CS294-13: Lecture #5 On a macro level, we can change our bias towards reflected vs. emitted contributions, or we can cast more rays toward light sources. On a micro or local level, we use importance sampling on the BRDF to choose ray directions. In order to keep our estimate unbiased, we need to weight our estimates by the inverse of the probability that they were picked. In other words, samples from low-probability areas are given a higher weight becuase they are more representative than the many samples from high-probability areas. This is no different from the original algorithm, where we used the factor fo 2 to compensate for the 5% probability of choosing either path. 3.1.1 Macro -level Importance Sampling Let s apply importance sampling to the previously outlined algorithm: T racep ath(p, d) : BEGIN Find nearest intersection p if L e = (,, ) then p emit := else p emit :=.9 end if if rand() < p emit then return 1 p emit L emit else Generate ray in random direction d return 1 1 p emit f r (d d ) (n d ) T racep ath(p, d ) end if END Aside: Do we want to sample regions with high values or high variance? In practice, finding high-value regions is easier. 3.1.2 Micro -level Importance Sampling To reflect the importance of direct lighiting, we can try the following variation: Reflected Ray variation: Pick a light source Trace a ray toward the light Trace a ray not hitting the light (via rejection sampling) 1/(solid angle) for ray to light source (1 - above) for non-light ray Also include an extra factor of two, to compensate for shooting two rays

CS294-13: Lecture #5 5 In some sense, this happens naturally anyway (show picture). However, this algorithm uses two rays on each iteration, rather than one, to decrease variance. 3.2 Russian Roulette In addition to importance sampling, we can exploit other techniques to decrease variance. In Russian roulette, we decrease the number of rays by terminating some rays prematurely and giving them extra weight. Specifically we choose a probability p term. We keep track of the cummulative weight in TracePath, and once weight < p term, we terminate the path, weighting it by 1/(1 p). Note that, using the terminated X as an estimator for X, we have E[X ] = p + (1 p) E[X] 1 p Thus, Russian roulette is also unbiased. = E[X] (1) 3.3 Path Tracing with Direct Lighting In this modification, we add the direct lighting contribution on every iteration of T racep ath, rather than stochastically in some iterations. Step 1: Choose a camera ray r := (x, y, u, v, t) weight := 1 L = Step 2: Find surface-ray intersection p Step 3: L += weight L[light sources] weight = reflectance Choose r based on the BRDF (p, r) goto Step 2 4 Path Tracing Extensions We briefly describe further extensions to the path-tracing algorithm, to improve the speed and quality of the resulting image.

6 CS294-13: Lecture #5 4.1 Unbiased Extensions 4.1.1 Bi-Directional Path Tracing Some of our previous variations accounted for the importance of direct lighting and weighed it appropriately. Similarly, some indirect lighting effects may be difficult to happen upon when tracing rays from the eye. In bi-directional path tracing, we sample paths starting at both the eye and the lights in the scene. Figure 3: This image was rendered using bi-directional path tracing. 4.1.2 Metropolis Light Transport Following on this idea of backward tracing, the Metropolis Light Tranpsort (MLT) algorithm similarly traces paths starting at the scene lights. The algorithm generates a sequence of paths by mutating a current path with some chosen probability of acceptance. The algorithm is particularly efficient when the scene is largely lit by indirect illumination. The Veach paper on MLT is here.

CS294-13: Lecture #5 7 4.2 Biased, Consistent Extensions Even if an estimator T N (X 1,..., X N ) for X is biased, it can still be acceptable if it is consistent. An estimator T N is consistent if lim N > T N (X 1,..., X N ) = X. That is, a consistent estimator approaches the correct value in the limit. 4.2.1 Noise Filtering In path tracing images, most of the noise is due to indirect illumination over multiple bounces, rather than direct illumination. By separating the direct and indirect contributions and applying noise-reducing algorithms on the latter, we can significantly reduce noise in the image without blurring the entire image significantly. The UCSD Graphics page contains a useful reference. 4.2.2 Adaptive Sampling In adaptive sampling, we devote extra samples to pixels where we have high variance. 4.2.3 Irradiance Caching Irradiance caching takes advantage of the observation that indirect illumination typically more slowly over a surface than direct illumination. With irradiance caching, we store the results of indirect illumination samples, and use these samples as estimates for nearby points. Using this method, we only compute indirect illumination in areas where we don t have enough estimates, saving significant computational effort. One reference for irradiance caching is given here. Figure 4: On the left is an image rendered using irradiance caching. On the right, the points where the indirect illumination estimates were cached are visualized on the image.

8 CS294-13: Lecture #5 5 2D Sampling Techniques We use sampling in a number of ways during path tracing. For instance, we might takes samples with a pixel, on the lens, over an area light source, or over a projected solid angle. We can generate random directions over a hemisphere via two methods: rejection sampling and inversion. (We ve seen these two methods in previous lectures as well.) 5.1 Rejection Sampling In essence, we generate random numbers in the cube, reject elements outside of the sphere, normalize, and flip to the proper hemisphere if necessary. 1: Generate (x, y, z), x, y, z [ 1, 1] 2: Reject if x 2 + y 2 + z 2 > 1 3: (x, y, z ) := Normalize(x, y, z) 4: Flip if(x, y, z ) n < Note that rejection sampling only works for uniform distributions. method, shown below, will generalize to non-uniform distributions. The inversion 5.2 Inversion Method For the upper hemisphere, we have: 1 = 1 2π = = π 2 π 2 2π π 2 sin θ dθ p(θ) dθ sin θ dθ dφ 2π 2π 1 2π dφ q(φ) dφ where p(θ) = sin(θ) and q(φ) = 1 are the separable probability distribution functinos. These yield cumuluative distributions functions 2π of and P (x) = x p(θ) dθ = cos θ ] x = 1 cos x

CS294-13: Lecture #5 9 Q(y) = y = φ 2π ] y = y 2π p(φ) dφ repsectively. By inverting these CDFs, we can sample the hemisphere surface uniformly. Note that inverting P directly suggests that we assign arccos (1 x) to θ, rather than arccos (x). However, sampling 1 x and x uniformly are equivalent, so we can use the simpler derivation. 1: Choose x [, 1], y [, 1], both uniformly 2: θ := arccos (x) 3: φ := 2πy 4: (x, y, z) := (sin θ cos φ, sin θ sin φ, cos θ) 5: Rotate to be around the normal, instead of the z-axis 5.3 Inversion Method For Importance Sampling In the Lambertian diffuse model, we d like to importance sample not only with respect to the BRDF, but also with respect to the cosine of the angle to the normal. Thus, we should use p(θ) = sin θ cos θ, rather than the p(θ) = sin θ as above. By performing a similar computation as above, we find that P (x) = 1 cos 2 (x), after normalization. Thus, for the Lambertian BRDF, we sample as follows: 1: Choose x [, 1], y [, 1], both uniformly 2: θ := arccos ( x) 3: φ := 2πy 4: (x, y, z) := (sin θ cos φ, sin θ sin φ, cos θ) 5: Rotate to be around the normal, instead of the z-axis