Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing...
Transcript of Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing...
![Page 1: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/1.jpg)
Bidirectional Path Tracing
CS295, Spring 2017
Shuang Zhao
Computer Science Department
University of California, Irvine
CS295, Spring 2017 Shuang Zhao 1
![Page 2: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/2.jpg)
Last Lecture
• Path integral formulation II
• Light path expressions
• Hints for implementing path tracing
CS295, Spring 2017 Shuang Zhao 2
![Page 3: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/3.jpg)
Today’s Lecture
• Bidirectional path tracing
CS295, Spring 2017 Shuang Zhao 3
![Page 4: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/4.jpg)
Recap: Path Integral Formulation
where Ω is the path space and for any ,and
CS295, Spring 2017 Shuang Zhao 4
![Page 5: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/5.jpg)
Recap: Local Path Sampling
• Path tracing
• Adjoint particle tracing
CS295, Spring 2017 Shuang Zhao 5
![Page 6: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/6.jpg)
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
![Page 7: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/7.jpg)
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!
![Page 8: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/8.jpg)
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
![Page 9: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/9.jpg)
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
![Page 10: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/10.jpg)
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
![Page 11: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/11.jpg)
Example: Modified Cornell Box
CS295, Spring 2017 Shuang Zhao 11
Path tracing Bidirectional path tracing
(Rendered in equal-time)
![Page 12: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/12.jpg)
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]
![Page 13: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/13.jpg)
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
![Page 14: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/14.jpg)
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
![Page 15: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/15.jpg)
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]
![Page 16: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/16.jpg)
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
![Page 17: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/17.jpg)
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
![Page 18: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/18.jpg)
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
![Page 19: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/19.jpg)
• 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
![Page 20: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/20.jpg)
• 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
![Page 21: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/21.jpg)
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
![Page 22: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/22.jpg)
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
![Page 23: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/23.jpg)
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
![Page 24: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/24.jpg)
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
![Page 25: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/25.jpg)
Evaluating Path Contribution
• To compute the contribution of a single path sample , we first consider the unweighted contribution
CS295, Spring 2017 Shuang Zhao 25
![Page 26: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/26.jpg)
Evaluating Path Contribution
• Recall that
CS295, Spring 2017 Shuang Zhao 26
Light sub-path Sensor sub-path
Connecting
edge
![Page 27: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/27.jpg)
Evaluating Path Contribution
• Then,
where
CS295, Spring 2017 Shuang Zhao 27
![Page 28: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/28.jpg)
Evaluating Path Contribution
• It follows that
CS295, Spring 2017 Shuang Zhao 28
![Page 29: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/29.jpg)
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
![Page 30: Bidirectional Path Tracingshz/courses/cs295/slides/12_bdpt.pdf · Bidirectional Path Tracing •Build light transport paths by connecting two sub-paths starting from the light source](https://reader036.fdocuments.in/reader036/viewer/2022071108/5fe335a2c14aaa060b52c557/html5/thumbnails/30.jpg)
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