Page 1 Monte Carlo Path Tracing Today Path tracing Random wals and Marov chains Eye vs. light ray tracing Bidirectional ray tracing Next Irradiance caching Photon mapping Light Path Sx (, x) 0 1 f ( x, x, x ) r 1 2 3 x 0 Gx (, x) 0 1 Gx ( 1, x2) x 1 x 2 f ( x, x, x ) r 0 1 2 L ( S x, 0 x,, ) 1 x2 x3 L ( x, x, x, x ) = S( x, x) G( x, x) f ( x, x, x ) G( x, x ) f ( x, x, x ) S 0 1 2 3 0 1 o 1 r 0 1 2 1 2 r 1 2 3
Page 2 Light Transport Integrate over all paths Lx (, x) 1 = = 1 M M L ( x,, x, x, x ) da( x ) da( x ) 2 2 S 0 2 1 0 2 Questions How to sample space of paths Path Tracing
Page 3 Penumbra: Trees vs. Paths 4 eye rays per pixel 16 shadow rays per eye ray 64 eye rays per pixel 1 shadow ray per eye ray Path Tracing: From Camera Step 1. Choose a camera ray r given the (x,y,u,v,t) sample weight = 1; Step 2. Find ray-surface intersection Step 3. if light return weight * Le(); else weight *= reflectance(r) Choose new ray r ~ BRDF pdf(r) Go to Step 2.
Page 4 M. Fajardo Arnold Path Tracer Cornell Box: Path Tracing 10 rays per pixel 100 rays per pixel From Jensen, Realistic Image Synthesis Using Photon Maps
Page 5 Path Tracing: Include Direct Lighting Step 1. Choose a camera ray r given the (x,y,u,v,t) sample weight = 1; Step 2. Find ray-surface intersection Step 3. weight += Lr(light sources) Choose new ray r ~ BRDF pdf(r) Go to Step 2. Discrete Random Wal
Page 6 Discrete Random Process Creation States Termination Transition Assign probabilities to each process p 0 i : probability of creation in state pij, : probability of transition from state i j p * i : probability of termination in state i i p * i = 1 p j i, j Discrete Random Process Creation States Termination Transition Equilibrium number of particles in each state P = p P + p 0 i i, j j i j 0 P= MP+ p M = p i, j i, j
Page 7 Discrete Random Wal Creation States Termination Transition 1. Generate random particles from sources. 2. Undertae a discrete random wal. 3. Count how many terminate in state i [von Neumann and Ulam; Forsythe and Leibler; 1950s] Monte Carlo Algorithm Define a random variable on the space of paths Path: Probability: Estimator: α = ( i, i,, i ) P( α ) W( α ) 1 2 Expectation: EW [ ] P( α ) W( α ) = = 1 α
Page 8 Monte Carlo Algorithm Define a random variable on the space of paths Probability: Estimator: P( α ) = p p p p 0 * i i, i i, i i δ Wj( α ) = * p 1 1 2 1 i, j i Estimator Count the number of particles terminating in state j δ EW [ ] ( p p p p ) 0 * i, j j = i1 i1, i 2 i 1, i i * = 1 i i pj 1 0 0 2 0 p Mp M p j j j = + +
Page 9 Equilibrium Distribution of States Total probability of being in states P ( ) P = I + M+ M + p 2 0 Note that this is the solution of the equation ( I M) P = p 0 Thus, the discrete random wal is an unbiased estimate of the equilibrium number of particles in each state Light Ray Tracing
Page 10 Examples Bacward ray tracing, Arvo 1986 Path Tracing: From Lights Step 1. Choose a light ray Choose a light source according to the light source power distribution function. Choose a ray from the light source radiance (area) or intensity (point) distribution function w = 1; Step 2. Trace ray to find surface intersect Step 3. Interaction
Page 11 Path Tracing: From Lights Step 1. Choose a light ray Step 2. Find ray-surface intersection Step 3. Interaction u = rand() if u < reflectance Choose new ray r ~ BRDF goto Step 2 else terminate on surface; deposit energy Bidirectional Path Tracing
Page 12 Bidirectional Ray Tracing = l+ e l = 0, e= 3 l = 1, e= 2 l = 2, e= 1 l = 3, e= 0 = 3 Path Pyramid =3 ( l = 2, e = 1) = 4 =5 =6 ( l = 5, e = 1) l From Veach and Guibas e
Page 13 Comparison Bidirectional path tracing Path tracing From Veach and Guibas Generating All Paths
Page 14 Adjoint Formulation Symmetric Light Path S( x, x ) 0 1 f ( x, x, x ) r 1 2 3 x 0 Gx (, x) 0 1 Gx ( 1, x2) x 1 x 2 Gx (, x) 2 3 x 3 f ( x, x, x ) r 0 1 2 R( x, x ) 2 3 M = S( x, x) G( x, x) f ( x, x, x ) G( x, x ) f ( x, x, x ) G( x, x ) R( x, x ) 0 1 o 1 r 0 1 2 1 2 r 1 2 3 2 3 2 3
Page 15 Symmetric Light Path S( x, x ) 0 1 f ( x, x, x ) = f ( x, x, x ) r 1 2 3 r 3 2 1 x 0 Gx (, x) 0 1 Gx ( 1, x2) x 1 x 2 Gx (, x) = Gx (, x) 2 3 3 2 x 3 f ( x, x, x ) r 0 1 2 R( x, x ) 2 3 = 0 1 0 1 r 0 1 2 1 2 r 1 2 3 2 3 2 3 M S( x, x) G( x, x) f ( x, x, x ) G( x, x ) f ( x, x, x ) G( x, x ) R( x, x ) Symmetric Light Path Sx ( 1, x0) f ( x, x, x ) r 3 2 1 x 0 Gx ( 1, x0) Gx (, x) x 1 2 1 x 2 Gx (, x) x 3 3 2 f ( x, x, x ) r 2 1 0 R( x, x ) 3 2 = 3 2 3 2 r 3 2 1 2 1 r 2 1 0 1 0 1 0 M R( x, x ) G( x, x ) f ( x, x, x) G( x, x) f ( x, x, x ) G( x, x ) S( x, x )
Page 16 Three Consequences 1. Forward estimate equal bacward estimate - May use forward or bacward ray tracing 2. Adjoint solution - Importance sampling paths 3. Solve for small subset of the answer Example: Linear Equations Solve a linear system Mx = b Solve for a single x i? Solve the adjoint equation Source Estimator x i ( 2 i i i ), < x + Mx + M x + b> More efficient than solving for all the unnowns [von Neumann and Ulam]