Variance Reduction

Monte Carlo Path Tracing
Today
Path tracing
Random walks and Markov chains
Eye vs. light ray tracing
Bidirectional ray tracing
Next
Irradiance caching
Photon mapping
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Light Path
S( x0 , x1 )
fr ( x1, x2 , x3 )
x0
G( x0 , x1 )
G( x1, x2 )
x2
x1
fr ( x0 , x1, x2 )
LS ( x0 , x1, x2 , x3 )
LS ( x0 , x1, x2 , x3 )  S( x0 , x1 )G( xo , x1 ) fr ( x0 , x1, x2 )G( x1, x2 ) fr ( x1, x2 , x3 )
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Light Transport
Integrate over all paths
L( xk 1, x k )


k 1 M 2
 L (x ,
S
0
, xk 2 , xk 1, xk )dA( x0 )
dA( x k 2 )
M2
Questions
How to sample space of paths
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Path Tracing
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
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
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.
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
M. Fajardo Arnold Path Tracer
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Cornell Box: Path Tracing
10 rays per pixel
100 rays per pixel
From Jensen, Realistic Image Synthesis Using Photon Maps
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
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.
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Discrete Random Walk
Discrete Random Process
Creation
States
Termination
Transition
Assign probabilities to each process
0
i
p : probability of creation in state i
pi , j : probability of transition from state i  j
*
i
p : probability of termination in state i
p  1   pi , j
*
i
j
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Discrete Random Process
Creation
States
Termination
Transition
Equilibrium number of particles in each state
Pi   pi , j Pj  pi0
M i , j  pi , j
j
P  MP  p0
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Discrete Random Walk
Creation
States
Termination
Transition



Generate random particles from sources.
Undertake a discrete random walk.
Count how many terminate in state i
[von Neumann and Ulam; Forsythe and Leibler; 1950s]
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Monte Carlo Algorithm
Define a random variable on the space of paths
Path:
Probability:
Estimator:
 k  (i1, i2 , , ik )
P( k )
W ( k )
Expectation:

E[W ]   P( k )W ( k )
k 1  k
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Monte Carlo Algorithm
Define a random variable on the space of
paths
Probability:
P(k )  p  pi1 ,i2
0
i1
pik 1 ,ik  p
*
ik
Estimator:
Wj ( k ) 
i , j
k
pi*k
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Estimator
Count the number of particles terminating in
state j

i ,j
0
*
E[Wj ]  
k 1 ik
 ( pi1 pi1 ,i2
i1
pik 1 ,ik pik )
k
*
j
p
  p    Mp    M p 
j
j
j
0
0
University of Texas at Austin CS395T - Advanced Image Synthesis
2
0
Spring 2007 Don Fussell
Equilibrium Distribution of States
Total probability of being in states P

P IMM 
2
p
0
Note that this is the solution of the equation
( I  M )P  p
0
Thus, the discrete random walk is an unbiased
estimate of the equilibrium number of particles in
each state
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Light Ray Tracing
Examples
Backward ray tracing, Arvo 1986
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
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
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
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
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Bidirectional Path Tracing
Bidirectional Ray Tracing
k le
l  0, e  3
l  1, e  2
l  2, e  1
l  3, e  0
k 3
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Path Pyramid
k 3
(l  2, e  1)
k 4
k 5
k 6
(l  5, e  1)
l
From Veach and Guibas
University of Texas at Austin CS395T - Advanced Image Synthesis
e
Spring 2007 Don Fussell
Comparison
Bidirectional path tracing
Path tracing
From Veach and Guibas
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Generating All Paths
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Adjoint Formulation
Symmetric Light Path
fr ( x1, x2 , x3 )
S ( x0 , x1 )
x0
G( x1, x2 )
G( x0 , x1 )
x2
G( x2 , x3 )
x1
fr ( x0 , x1, x2 )
x3
R( x2 , x3 )
M  S( x0 , x1 )G( xo , x1 ) fr ( x0 , x1, x2 )G( x1, x2 ) fr ( x1, x2 , x3 )G( x2 , x3 )R( x2 , x3 )
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Symmetric Light Path
fr ( x1 , x2 , x3 )  fr ( x3 , x2 , x1 )
S ( x0 , x1 )
x0
G( x1, x2 )
G( x0 , x1 )
x2
G( x2 , x3 )  G( x3 , x2 )
x1
fr ( x0 , x1, x2 )
x3
R( x2 , x3 )
M  S( x0 , x1 )G( x0 , x1 ) fr ( x0 , x1, x2 )G( x1, x2 ) fr ( x1, x2 , x3 )G( x2 , x3 )R( x2 , x3 )
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Symmetric Light Path
fr ( x3 , x2 , x1 )
S ( x1 , x0 )
x0
G( x2 , x1 )
G( x1 , x0 )
x2
x1
fr ( x2 , x1 , x0 )
G( x3 , x2 )
x3
R( x3 , x2 )
M  R( x3 , x2 )G( x3 , x2 ) fr ( x3 , x2 , x1 )G( x2 , x1 ) fr ( x2 , x1, x0 )G( x1, x0 )S( x1, x0 )
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Three Consequences
 Forward estimate equal backward estimate
- May use forward or backward ray tracing
 Adjoint solution
- Importance sampling paths
 Solve for small subset of the answer
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell
Example: Linear Equations
Solve a linear system Mx  b
Solve for a single xi?
Solve the adjoint equation
Source
Estimator
xi
2
 ( xi  Mxi  M xi 
), b 
More efficient than solving for all the unknowns
[von Neumann and Ulam]
University of Texas at Austin CS395T - Advanced Image Synthesis
Spring 2007 Don Fussell