SLIDE 1 Global Illumination II
Shih-Chin Weng
shihchin.weng@gmail.com
SLIDE 2
PantaRay from NVidia & Weta
Case Study
SLIDE 3
Scenario of PantaRay
SLIDE 4
Scenario of PantaRay
SLIDE 5 Case Study: PantaRay
etc.
Bucking Splitting to chunks (green) BVH construction van Emde Boas Layout Converting to Bricks
SLIDE 6
Hyperion from Disney Animation
Case Study
SLIDE 7 Concerns of Production Renderers
- Computation bound or I/O bound?
- Challenges
– Massive geometry data set
- Buildings, forest, hair, fur, etc.
– Large amount of high-resolution textures
– Reduce I/O costs – Improve memory access patterns
SLIDE 8 The Beauty of San Fransokyo
[Video courtesy of Disney Animation.]
SLIDE 9 City View of San Fransokyo
[Video courtesy of Disney Animation.]
SLIDE 10 Introduction of Hyperion in Big Hero 6
– Uni-directional path tracer (w/o intermediate caches) – Physically based rendering – Support volumetric rendering and mesh lights, etc.
– 83,000 buildings – 216,000 street lights
SLIDE 11 Core Ideas To Ensure Coherence
- Sort potentially out-of-core ray batches to extract ray
groups from a complex scene
– There are 30~60M rays per batch – Perform scene traversal per ray batch at a time
- Sort ray hits for deferred shading w.r.t. shading
context (mesh ID + face ID)
– Hit points are grouped by mesh ID, then sorted by face ID
- Achieve sequential texture reads with PTex
SLIDE 12 Tracing Pipeline
[Eisenacher et al., EGSR’13]
SLIDE 13 Tracing Pipeline
[Eisenacher et al., EGSR’13]
SLIDE 14
Render Equation
SLIDE 15
Where Does Light Come From?
direct indirect
SLIDE 16 Global = Direct + Indirect Lighting
Direct Illumination Global Illumination
SLIDE 17 Global = Direct + Indirect Lighting
Direct Illumination Global Illumination color bleeding
SLIDE 18 Render Equation
𝑀 𝑦, 𝜕𝑝 = 𝑀𝑓 𝑦, 𝜕𝑝 + න
Ω
𝑀 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝 𝜕𝑗 ⋅ 𝑜 𝑒𝜕𝑗
Unknown!!
SLIDE 19 Render Equation
𝑀 𝑦, 𝜕𝑝 = 𝑀𝑓 𝑦, 𝜕𝑝 + න
Ω
𝑀 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝 𝜕𝑗 ⋅ 𝑜 𝑒𝜕𝑗
Unknown!!
How do we solve this kind of equation??
SLIDE 20 Render Equation
𝑀 𝑦, 𝜕𝑝 = 𝑀𝑓 𝑦, 𝜕𝑝 + න
Ω
𝑀 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝 𝜕𝑗 ⋅ 𝑜 𝑒𝜕𝑗
Unknown!!
How do we solve this kind of equation??
SLIDE 21 Quadrature
– Rectangle/trapezoid – Gaussian quadrature
– The dimension of render equation is infinity!! – That’s why we need Monte Carlo
https://en.wikipedia.org/wiki/Numerical_integration
SLIDE 22
Monte Carlo Integration
SLIDE 23 event sample space random variable 𝑌: 𝑇 → ℝ Ep f x = නf x p x dx V 𝑔(𝑦) = E 𝑔 𝑦 − 𝐹 𝑔 𝑦
2
V 𝑔(𝑦) = 𝐹 𝑔 𝑦
2 − 𝐹 𝑔 𝑦 2
P 𝐹 𝑇 probability set function Excepted value of a random variable Variance
It’s a function, NOT a variable!!
Probability Review
SLIDE 24 Concepts
- Use random numbers to approximate integrals
- It only estimates the values of integrals
– i.e. gives the right answer on average
- It only requires to be able to evaluate the integrand
at arbitrary points
– Nice property for multi-dimensional integrand such as radiance in render equation
SLIDE 25
Monte Carlo Sampling
Easy to implement Efficient for high dimensional integrals ꭙ Noise (variance) ꭙ Low convergence rate (1/ 𝑜)
– But we don’t have many other choices in high dimensional space!
SLIDE 26 Estimate 𝜌 with Monte Carlo Sampling
𝑄(𝑄𝑝𝑗𝑜𝑢𝑡𝐽𝑜𝐷𝑗𝑠𝑑𝑚𝑓) = 𝜌𝑠2 4𝑠2 ⇒ 𝜌 = 4𝑄 2r
https://en.wikipedia.org/wiki/Monte_Carlo_method#/media/File:Pi_30K.gif
SLIDE 27 Probability Density Function (PDF)
Pr x ∈ a, b = න
a 𝑐
𝑞 𝑦 𝑒𝑦
The relative probability of a random variable taking on a particular value
𝑒𝑄𝑠 𝑦 𝑒𝑦
≥ 0
−∞ ∞ 𝑞 𝑦 𝑒𝑦 = 1, Pr 𝑦 ∈ ℝ = 1
SLIDE 28 Cumulative Distribution Function (CDF)
𝑄 𝑦 = 𝑄𝑠 𝑌 ≤ 𝑦
Figure from “Global Illumination Compendium”, Philip Dutré
SLIDE 29 Properties of Estimators
- Suppose 𝑅 is the unknown quantity
- Unbiased: E 𝐺𝑂 = 𝑅
– Bias β FN = E 𝐺
𝑂 − 𝑅
– The expected value is independent of sample size N
𝑂→∞ 𝛾 𝐺 𝑂 = 0
𝑂→∞ 𝐹 𝐺 𝑂 = 𝑅
SLIDE 30
Law of Large Numbers
Pr E x = lim
N→∞
1 𝑂
𝑗=1 𝑂
𝑦𝑗 = 1 E 𝑔(𝑦) ≈ 1 𝑂
𝑗=1 𝑂
𝑔(𝑦𝑗)
SLIDE 31
Law of Large Numbers
Pr E x = lim
N→∞
1 𝑂
𝑗=1 𝑂
𝑦𝑗 = 1 E 𝑔(𝑦) ≈ 1 𝑂
𝑗=1 𝑂
𝑔(𝑦𝑗)
N
SLIDE 32
Law of Large Numbers
Pr E x = lim
N→∞
1 𝑂
𝑗=1 𝑂
𝑦𝑗 = 1 E 𝑔(𝑦) ≈ 1 𝑂
𝑗=1 𝑂
𝑔(𝑦𝑗)
N
SLIDE 33 Insufficient Samples = High Variance = Noise
[Rendered with pbrt.v3]
SLIDE 34 Monte Carlo Estimation
න𝑔 𝑦 𝑒𝑦 = න 𝑔 𝑦 𝑞 𝑦 𝑞 𝑦 𝑒𝑦 = 𝐹 𝑔 𝑦 𝑞 𝑦 ≈ 1 𝑂
𝑗=1 𝑂 𝑔 𝑦
𝑞 𝑦
estimator
න
Ω
𝑀𝑗 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝 𝜕𝑗 ⋅ 𝑜 𝑒𝜕𝑗 1 𝑂
𝑗=1 𝑂 𝑀𝑗 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝
𝜕𝑗 ⋅ 𝑜 𝑞 𝜕𝑗
≈
Tricky Part!!
SLIDE 35
Light Transport Algorithms
SLIDE 36 Light Transport Algorithms
- Path tracing
- Light tracing
- Bidirectional path tracing
- Photon mapping
- and many more…
SLIDE 37
Path Tracing
SLIDE 38
Light Tracing
SLIDE 39
Bidirectional Path Tracing
SLIDE 40
Photon Tracing
SLIDE 41
Photon Tracing
SLIDE 42 http://iliyan.com/publications/VertexMerging/comparison/
SLIDE 43 Path Tracing Progressive Photon Mapping Bidirectional Path Tracing VCM
http://iliyan.com/publications/VertexMerging/comparison/
SLIDE 44
Importance Sampling
SLIDE 45 Direct Illumination
𝑀𝑠 𝑦, 𝜕𝑝 = න
Ω
𝑀 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝 𝜕𝑗 ⋅ 𝑜 𝑒𝜕𝑗
1 𝑂
𝑗=1 𝑂 𝑀𝑗 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝
𝜕𝑗 ⋅ 𝑜 𝑞 𝜕𝑗
- 1. 𝑞 𝜕𝑗 ∝ 𝑀𝑗 𝑦, 𝜕𝑗 𝑔 𝜕𝑗, 𝜕𝑝
𝜕𝑗 ⋅ 𝑜 ?
- 2. 𝑞 𝜕𝑗 ∝ 𝑀𝑗 𝑦, 𝜕𝑗 ?
- 3. 𝑞 𝜕𝑗 ∝ 𝑔 𝜕𝑗, 𝜕𝑝
𝜕𝑗 ⋅ 𝑜 ?
≈
SLIDE 46
Uniform Sampling
SLIDE 47
Importance Sampling
SLIDE 48 Importance Sampling (Cont’d)
FN = 1 N 𝑔 𝑌𝑗 𝑞 𝑌𝑗 , 𝑥ℎ𝑓𝑠𝑓 𝑞(𝑌𝑗) ∝ 𝑔(𝑌𝑗)
Unknown!!
[Premože’10]
SLIDE 49 Importance Sampling (Cont’d)
FN = 1 N 𝑔 𝑌𝑗 𝑞 𝑌𝑗 , 𝑥ℎ𝑓𝑠𝑓 𝑞(𝑌𝑗) ∝ 𝑔(𝑌𝑗)
Unknown!!
Bad choice of density function would increase the variance (to infinity)!!
[Premože’10]
SLIDE 50
Emission Sampling
SLIDE 51
BRDF Sampling
SLIDE 52
High Throughput Connection
SLIDE 53 Challenges
- It’s hard to get the PDF of the convolution of
– Incoming radiance 𝑀 𝑦, 𝜕𝑗 and – BRDF 𝑔 𝜕𝑗, 𝜕𝑝
- There’s an implicit visibility term within 𝑀 𝑦, 𝜕𝑗
– Visibility term can’t be derived before tracing
- Using machine learning to adapt sampling distribution?
- Dilemma
– Highly specular BRDFs with point light sources
SLIDE 54
Highly Specular BRDF & Point Light
BRDF Sampling Light Sampling
SLIDE 55 Multiple Importance Sampling
[Veach’95]
SLIDE 56 Multiple Importance Sampling (Cont’d)
1 𝑜𝑔
𝑗=1 𝑜𝑔 𝑔 𝑌𝑗 𝑌𝑗 𝑥𝑔(𝑌𝑗)
𝑞𝑔 𝑌𝑗 + 1 𝑜
𝑘=1 𝑜 𝑔 𝑍 𝑘 𝑍 𝑘 𝑥 (𝑍 𝑘)
𝑞 𝑍
𝑘
- 𝑜𝑙 is the number of samples taken from the 𝑞𝑙
- the weighting functions 𝑥𝑙 take all of the different ways
that a sample 𝑌𝑗 𝑝𝑠 𝑍
𝑗 could have been generated
ws x = nsps x σ𝑗 𝑜𝑗𝑞𝑗 𝑦 ws x = nsps x
β
σ𝑗 𝑜𝑗𝑞𝑗 𝑦
𝛾
SLIDE 57 Multiple Importance Sampling (Cont’d)
1 𝑜𝑔
𝑗=1 𝑜𝑔 𝑔 𝑌𝑗 𝑌𝑗 𝑥𝑔(𝑌𝑗)
𝑞𝑔 𝑌𝑗 + 1 𝑜
𝑘=1 𝑜 𝑔 𝑍 𝑘 𝑍 𝑘 𝑥 (𝑍 𝑘)
𝑞 𝑍
𝑘
- 𝑜𝑙 is the number of samples taken from the 𝑞𝑙
- the weighting functions 𝑥𝑙 take all of the different ways
that a sample 𝑌𝑗 𝑝𝑠 𝑍
𝑗 could have been generated
ws x = nsps x σ𝑗 𝑜𝑗𝑞𝑗 𝑦 ws x = nsps x
β
σ𝑗 𝑜𝑗𝑞𝑗 𝑦
𝛾