Bidirectional Path Tracing
CS295, Spring 2017
Shuang Zhao
Computer Science Department
University of California, Irvine
CS295, Spring 2017 Shuang Zhao 1
Last Lecture
• Path integral formulation II
• Light path expressions
• Hints for implementing path tracing
CS295, Spring 2017 Shuang Zhao 2
Today’s Lecture
• Bidirectional path tracing
CS295, Spring 2017 Shuang Zhao 3
Recap: Path Integral Formulation
where Ω is the path space and for any ,and
CS295, Spring 2017 Shuang Zhao 4
Recap: Local Path Sampling
• Path tracing
• Adjoint particle tracing
CS295, Spring 2017 Shuang Zhao 5
Example: Modified Cornell Box
• Area light facing up• The scene is lit largely
indirectly
• Camera facing a mirrored ball• The scene is observed
indirectly
• Difficult to render for both path tracing and adjoint particle tracing
CS295, Spring 2017 Shuang Zhao 6
Cornell Box
Mirrored
ball
Example: Modified Cornell Box
• Difficult to render for both path tracing and adjoint particle tracing
CS295, Spring 2017 Shuang Zhao 7
Path tracing Adjoint particle tracing
Unrenderable!
Example: Modified Cornell Box
• Path tracing
• Most shadow rays give zero contribution by hitting the wrong side of the light source
• Largely disabling next-event estimation!
CS295, Spring 2017 Shuang Zhao 8
Cornell Box
Mirrored
ball
Unrenderable!
Example: Modified Cornell Box
• Adjoint particle tracing
• Most shadow rays give zero contribution
• Cannot get back to the pinhole camera by randomly hitting the mirrored ball
CS295, Spring 2017 Shuang Zhao 9
Cornell Box
Mirrored
ball
X
Example: Modified Cornell Box
• Is there a better way?
• Yes: bidirectional path tracing (BDPT)• Trace two sub-paths from both ends
• Connect in between
CS295, Spring 2017 Shuang Zhao 10
Cornell Box
Mirrored
ball
Light
sub-path
Sensor
sub-path
Example: Modified Cornell Box
CS295, Spring 2017 Shuang Zhao 11
Path tracing Bidirectional path tracing
(Rendered in equal-time)
Bidirectional Path Tracing
• Build light transport paths by connecting two sub-paths starting from the light source and the sensor, respectively
• Use multiple importance sampling (MIS) to properly weight each path
CS295, Spring 2017 Shuang Zhao 12
[Veach 1997]
Building Transport Paths
• For any , create light sub-path and sensor sub-path (using local path sampling)
• The full path is obtained by concatenating these two pieces:
CS295, Spring 2017 Shuang Zhao 13
Building Transport Paths
• Remark 1: can be zero because:
• andmay be zero (e.g., when zt-1 does not belong to the hemisphere around the normal at ys-1)
• may be zero (e.g., when are
mutually invisible)
CS295, Spring 2017 Shuang Zhao 14
Building Transport Paths
• Remark 2: there is more than one sampling technique for each path length• (k + 1) techniques for paths with k vertices
CS295, Spring 2017 Shuang Zhao 15
[Veach
1997]
Building Transport Paths
• For each s and t, the construction of gives a probability density
• Similar to the unidirectional case,equals the product of densities of sampling both sub-paths
• More details on this soon
CS295, Spring 2017 Shuang Zhao 16
Building Transport Paths
• Using multiple importance sampling, we can combine all these path sampling schemes, resulting in:
where ws,t is the weighting function
• Balance heuristic
• Power heuristic
CS295, Spring 2017 Shuang Zhao 17
Building Paths in Batches
• Instead of generating each path sample independently (i.e., one light and one sensor sub-path for
each ), path samples can be built in batches
• First, generate both sub-paths
CS295, Spring 2017 Shuang Zhao 18
• Then, connecting each pair of vertices ys, zt
yields a full path sample
• (nL nE) full paths can be constructed from one pair of light and sensor sub-paths
Building Paths in Batches
CS295, Spring 2017 Shuang Zhao 19
Connecting
edge
• Then, connecting each pair of vertices ys, zt
yields a full path sample
• (nL nE) full paths can be constructed from one pair of light and sensor sub-paths
Building Paths in Batches
CS295, Spring 2017 Shuang Zhao 20
Building Paths in Batches
• Then, connecting each pair of vertices ys, zt
yields a full path sample
• Remark 1: to ensure unbiasedness, nL, nE
have to be picked randomly (e.g., via Russian
roulette) per batch
CS295, Spring 2017 Shuang Zhao 21
Building Paths in Batches
• Remark 2: after obtaining nL, nE for batch i,
becomes
• nL, nE vary between batches
CS295, Spring 2017 Shuang Zhao 22
Sub-Path Generation
• Light sub-path
• Sample y0 on the surface of a light source with density
• After creating each vertex yi, terminate the path with probability 1 – q(yi), causing nL = i + 1
• Otherwise, draw a direction ωi based on Le(y0, ω) when i = 0 and when i > 0
• Let yi + 1 = RayTrace(yi, ωi). Then,
CS295, Spring 2017 Shuang Zhao 23
Computing Probability Densities
• Given nL, nE and the two corresponding sub-paths and , for any , we have
where
CS295, Spring 2017 Shuang Zhao 24
Capturing the
change of measure
Survival
probability
Evaluating Path Contribution
• To compute the contribution of a single path sample , we first consider the unweighted contribution
CS295, Spring 2017 Shuang Zhao 25
Evaluating Path Contribution
• Recall that
CS295, Spring 2017 Shuang Zhao 26
Light sub-path Sensor sub-path
Connecting
edge
Evaluating Path Contribution
• Then,
where
CS295, Spring 2017 Shuang Zhao 27
Evaluating Path Contribution
• It follows that
CS295, Spring 2017 Shuang Zhao 28
Evaluating Weighting Function
• When using the balance heuristic, we have
where for all j
• Most terms in pi cancels with those in ps when evaluating pi /ps
CS295, Spring 2017 Shuang Zhao 29
Implementation Details
• Survival probability q can be picked adaptively
• For each yi on the light sub-path, it is desirable to have
• If , q(yi) then becomes the surface albedo at yi
CS295, Spring 2017 Shuang Zhao 30