Classical methods in offline rendering

54
Classical Methods in Offline Rendering Jerry Cao Content Team

Transcript of Classical methods in offline rendering

Page 1: Classical methods in offline rendering

Classical Methods in Offline RenderingJerry Cao

Content Team

Page 2: Classical methods in offline rendering

OverView

οΏ½ Basics in Computer Graphics

οΏ½ Whitted Ray Tracing

οΏ½ Path Tracing

οΏ½ Light Tracing

οΏ½ Instant Radiosity

οΏ½ Bidirectional Path Tracing

Page 3: Classical methods in offline rendering

Ray Traced Images

Page 4: Classical methods in offline rendering

Ray Traced Images

Page 5: Classical methods in offline rendering

Ray Traced Images

Page 6: Classical methods in offline rendering

Why Ray Tracing?

οΏ½ Two well known methods for rendering.οΏ½ Rasterization

οΏ½ Ray Tracing

οΏ½ Why Ray Tracing?οΏ½ Unbiased Methods Available

οΏ½ Similar to how reality works

οΏ½ Much higher quality

Page 7: Classical methods in offline rendering

Why Ray Tracing?

οΏ½ Soft Shadow

οΏ½ Color Bleeding

οΏ½ Reflection & Refraction

οΏ½ Caustics

οΏ½ Depth of Field

οΏ½ Motion Blur

οΏ½ Subsurface Scattering

οΏ½ …

Page 8: Classical methods in offline rendering

How to do Ray Tracing

Page 9: Classical methods in offline rendering

The very Basics

οΏ½ Solid AngleοΏ½ An object's solid angle in steradians is equal to the area of the segment of a unit

sphere, centered at the angle's vertex, that the object covers.

Page 10: Classical methods in offline rendering

The very Basics

οΏ½ FluxοΏ½ Energy passing through a specific area per unit time

οΏ½ IrradianceοΏ½ Flux per unit area

οΏ½ RadianceοΏ½ Flux density per unit area, per solid angle

οΏ½ Bidirectional Reflection Density Function (BRDF)οΏ½ Gives a formalism for describing the reflection from a surface

οΏ½ π‘“π‘Ÿ 𝑝, 𝑀𝑖, π‘€π‘œ =π‘‘πΏπ‘œ 𝑝,π‘€π‘œπ‘‘πΈ 𝑝,𝑀𝑖

Page 11: Classical methods in offline rendering

Rendering Equation

οΏ½ Or Light Transport Equation (LTE)

οΏ½πΏπ‘œ 𝑝,π‘€π‘œ = 𝐿𝑒 𝑝,π‘€π‘œ + ∫ 𝐿𝑖 𝑝, 𝑀𝑖 𝑓 𝑝,𝑀𝑖, π‘€π‘œ cosπœƒπ‘–π‘‘π‘€π‘–

Page 12: Classical methods in offline rendering

Monte Carlo Integration

οΏ½ To Evaluate an IntegralοΏ½ 𝐼 = βˆ«Ξ©π‘“(π‘₯)dx

οΏ½ We can use the following estimation

οΏ½ 𝐹𝑁 =1𝑁Σ𝑖=1𝑁

𝑓 π‘₯𝑖𝑝 π‘₯𝑖

οΏ½ Proof

οΏ½

𝐸 𝐹𝑁 = 𝐸1𝑁Σ𝑖=1𝑁

𝑓 π‘₯𝑖𝑝 π‘₯𝑖

= 1𝑁Σ𝑖=1𝑁 ∫Ω

𝑓 π‘₯𝑖𝑝 π‘₯𝑖

𝑝 π‘₯𝑖 𝑑 π‘₯

= ∫Ω 𝑓 π‘₯ 𝑑π‘₯= 𝐼

Page 13: Classical methods in offline rendering

Why Monte Carlo

οΏ½ Estimation goes the same way regardless of how many dimensions there are.

οΏ½ Only need to be able to evaluate the function at arbitrary point.

οΏ½ Cons:

οΏ½ Low Convergence Rate: 1βˆšπ‘

Page 14: Classical methods in offline rendering

Importance Sampling

οΏ½ Sample where it matters most

οΏ½ An example:

οΏ½ 𝑓 π‘₯ = { 0.01 π‘₯ ∈ 0, 0.011.01 π‘₯ ∈ [0.01, 1)

οΏ½ Perfect pdf:

οΏ½ p π‘₯ = { 0.01 π‘₯ ∈ 0, 0.011.01 π‘₯ ∈ [0.01, 1)

οΏ½ A terrible pdf:

οΏ½ p π‘₯ = { 99.01 π‘₯ ∈ 0, 0.010.01 π‘₯ ∈ [0.01, 1)

Page 15: Classical methods in offline rendering

Multiple Importance Sampling

οΏ½πΉπ‘šπ‘–π‘  = Σ𝑖=1𝑛1𝑛𝑖Σ𝑗=1𝑛𝑖 𝑀𝑖 𝑋𝑖,𝑗

𝑓 𝑋𝑖,𝑗𝑝𝑖 𝑋𝑖,𝑗

οΏ½π‘Šπ‘– should satisfy the following condition

�Σ𝑖=1𝑛 𝑀𝑖 π‘₯ = 1 𝑖𝑓 𝑓 π‘₯ β‰  0�𝑀𝑖 π‘₯ = 0 𝑖𝑓 𝑝𝑖 π‘₯ = 0

Page 16: Classical methods in offline rendering

Multiple Importance Sampling

οΏ½ Common weight factors:οΏ½ Balance Heuristic

�𝑀𝑖 π‘₯ =𝑛𝑖𝑝𝑖 π‘₯Ξ£π‘˜π‘›π‘˜π‘π‘˜ π‘₯

οΏ½ Power Heuristic

�𝑀𝑖 π‘₯ =π‘›π‘–π‘žπ‘–

𝑛

Ξ£π‘˜π‘›π‘˜π‘žπ‘˜π‘›

Page 17: Classical methods in offline rendering

Multiple Importance Sampling

οΏ½ MIS in direct light sampling

Page 18: Classical methods in offline rendering

Multiple Importance Sampling

οΏ½ MIS in Bidirectional Path Tracing

Page 19: Classical methods in offline rendering

How to Sample a pdf

οΏ½ Rejection MethodοΏ½ Inefficient

οΏ½ Inversion method

οΏ½ Compute the CDF 𝑃 π‘₯ = ∫0π‘₯ 𝑝 𝑑 𝑑𝑑

οΏ½ Compute the inverse of CDF π‘ƒβˆ’1 π‘₯

οΏ½ Obtain a uniformly distributed random number, Β΅

οΏ½ Compute 𝑋 = π‘ƒβˆ’1(πœ‡)

Page 20: Classical methods in offline rendering

Whitted Ray Tracing

οΏ½ Only dirac delta BRDF and light sources are considered.οΏ½ Pure Reflective & Refractive

οΏ½ Point light & directional light

Page 21: Classical methods in offline rendering

My GPU Solution

οΏ½ CUDA accelerated

οΏ½ Some data:οΏ½ 87w+ triangles in the dragon

οΏ½ 640 x 480 resolution

οΏ½ 7-8 fps on a GTX 260

Page 22: Classical methods in offline rendering

Light Transport Equation

οΏ½πΏπ‘œ 𝑝, π‘€π‘œ = 𝐿𝑒 𝑝, π‘€π‘œ + ∫ 𝐿𝑖 𝑝, 𝑀𝑖 𝑓 𝑝, 𝑀𝑖, π‘€π‘œ cosπœƒπ‘–π‘‘π‘€π‘–

Page 23: Classical methods in offline rendering

Relation between dA and dw

�𝑑𝑀 = π‘π‘œπ‘ πœƒπ‘Ÿ2𝑑𝐴

�𝑃𝐴 =π‘π‘œπ‘ πœƒπ‘Ÿ2𝑃𝑀

Page 24: Classical methods in offline rendering

Deeper dive into LTE

‒𝐿 𝑝0,π‘€π‘œ = 𝐿𝑒 𝑝0, π‘€π‘œ + ∫ 𝐿 𝑝0, 𝑀 𝑓 𝑝0,𝑀, π‘€π‘œ cosπœƒ0β†’1𝑑𝑀

= 𝐿𝑒 𝑝1 β†’ 𝑝0 + ∫ 𝐿 𝑝2 β†’ 𝑝1 𝑓 𝑝2 β†’ 𝑝1 β†’ 𝑝0𝑉(𝑝1↔𝑝2)π‘π‘œπ‘ πœƒ1β†’2π‘π‘œπ‘ πœƒ2β†’1

π‘Ÿ2𝑑𝐴2

= 𝐿𝑒 𝑝1 β†’ 𝑝0 + ∫ 𝐿 𝑝2 β†’ 𝑝1 𝑓 𝑝2 β†’ 𝑝1 β†’ 𝑝0 𝐺 𝑝1 ↔ 𝑝2 𝑑𝐴2

β€’ 𝐺 𝑝1 ↔ 𝑝2 =𝑉(𝑝1↔𝑝2)π‘π‘œπ‘ πœƒ1β†’2π‘π‘œπ‘ πœƒ2β†’1π‘Ÿ2

Page 25: Classical methods in offline rendering

Deeper dive into LTE

οΏ½ 𝐿 𝑝1 β†’ 𝑝0 = 𝐿𝑒 𝑝1 β†’ 𝑝0 + ∫ 𝐿 𝑝2 β†’ 𝑝1 𝑓 𝑝2 β†’ 𝑝1 β†’ 𝑝0 𝐺 𝑝1 ↔ 𝑝2 𝑑𝐴2

οΏ½ In the same way we can expend the red one:

οΏ½ 𝐿 𝑝2 β†’ 𝑝1 = 𝐿𝑒 𝑝2 β†’ 𝑝1 + ∫ 𝐿 𝑝3 β†’ 𝑝2 𝑓 𝑝3 β†’ 𝑝2 β†’ 𝑝1 𝐺 𝑝2 ↔ 𝑝3 𝑑𝐴3

οΏ½ Dropping the brown part, we have the following equation for direct illumination:

οΏ½ 𝐿 𝑝1 β†’ 𝑝0 = 𝐿𝑒 𝑝1 β†’ 𝑝0 + ∫ 𝐿𝑒 𝑝2 β†’ 𝑝1 𝑓 𝑝2 β†’ 𝑝1 β†’ 𝑝0 𝐺 𝑝1 ↔ 𝑝2 𝑑𝐴2

Page 26: Classical methods in offline rendering

Direct(Local) Illumination vs Global Illumination

Page 27: Classical methods in offline rendering

Deeper dive into LTE

οΏ½

𝐿 𝑝0,π‘€π‘œ = 𝐿𝑒 𝑝1 β†’ 𝑝0+ ∫ 𝐿𝑒 𝑝2 β†’ 𝑝1 𝑓 𝑝2 β†’ 𝑝1 β†’ 𝑝0 𝐺 𝑝1 ↔ 𝑝2 𝑑𝐴2+ 𝐿𝑒 𝑝3 β†’ 𝑝2 𝑓 𝑝3 β†’ 𝑝2 β†’ 𝑝1 𝐺 𝑝2 ↔ 𝑝3 𝑓 𝑝2 β†’ 𝑝1 β†’ 𝑝0 𝐺 𝑝1 ↔ 𝑝2 𝑑𝐴3𝑑𝐴2

…+βˆ«β€¦βˆ«πΏπ‘’ 𝑝𝑛 β†’ π‘π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 π‘π‘˜ β†’ π‘π‘˜βˆ’1 β†’ π‘π‘˜βˆ’2 𝐺 π‘π‘˜ ↔ π‘π‘˜βˆ’1 𝑑𝐴𝑛 …𝑑𝐴2

οΏ½ We define the following term:

οΏ½ 𝑇𝑛(𝑝1 β†’ 𝑝0)=βˆ«β€¦βˆ«πΏπ‘’ 𝑝𝑛 β†’ π‘π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 π‘π‘˜ β†’ π‘π‘˜βˆ’1 β†’ π‘π‘˜βˆ’2 𝐺 π‘π‘˜ ↔ π‘π‘˜βˆ’1 𝑑𝐴𝑛 …𝑑𝐴2

Page 28: Classical methods in offline rendering

Deeper dive into LTE

οΏ½ 𝐿 𝑝1 β†’ 𝑝0 = 𝑖=1𝑖=βˆžπ‘‡π‘–(𝑝1 β†’ 𝑝0)

οΏ½ It turns out to be a very simple equation, what it says is relatively straightforward, radiance from P1 to P0 is the combination of:οΏ½ Radiance comes from light directly

οΏ½ Direct Illumination

οΏ½ Light contribution from multiple bounces

Page 29: Classical methods in offline rendering

Russian Roulette

οΏ½ For each Ti after several bounces, we start Russian roulette:

οΏ½ 𝑇𝑖′ = {𝑇𝑖𝑝π‘₯ ∈ 0, 𝑝

0 π‘₯ ∈ [𝑝, 1)

οΏ½ The average of 𝑇𝑖′ is exactly the same with 𝑇𝑖, which makes the above estimation unbiased.

οΏ½ One step further:

οΏ½ 𝐿 𝑝1 β†’ 𝑝0 = T1 + T2 + T3 + T4 +1𝑝(𝑇5 +

1𝑝(𝑇6 + β‹―))

Page 30: Classical methods in offline rendering

Evaluate the integral of LTE

οΏ½ We’ll focus on path with specific number of vertices.οΏ½ 𝑇𝑛(𝑝1 β†’ 𝑝0)=βˆ«β€¦βˆ«πΏπ‘’ 𝑝𝑛 β†’ π‘π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 π‘π‘˜ β†’ π‘π‘˜βˆ’1 β†’ π‘π‘˜βˆ’2 𝐺 π‘π‘˜ ↔ π‘π‘˜βˆ’1 𝑑𝐴𝑛 …𝑑𝐴2

οΏ½ With Monte Carlo method, we only need to evaluate the following equation:

οΏ½ 𝑇𝑛 𝑝1 β†’ 𝑝0 =1𝑁 𝑖=1𝑁

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 𝐺 𝑝𝑖,π‘˜β†”π‘π‘–,π‘˜βˆ’1

𝑃𝐴 𝑝𝑖,0 𝑃𝐴 𝑝𝑖,1 𝑃𝐴 𝑝𝑖,2 …𝑃𝐴(𝑝𝑖,𝑛)

οΏ½ The PDFs are different in different methods.

Page 31: Classical methods in offline rendering

Path Tracing

οΏ½ Tracing rays from camera

οΏ½ Whitted ray tracing stops if brdf is not a delta one, while path tracing doesn’t

Page 32: Classical methods in offline rendering

PDF of sampling a path of n+1 vertices

οΏ½ We’ll assume 𝑃 𝑝0 and 𝑃 𝑝1 are both 1 for simplicity. That said depth of field is not taken into account so far.

οΏ½ Since we generate new vertex by sampling a new ray from current bxdf, we only have the PDF w.r.t solid instead of area.οΏ½ Sampling pdf w.r.t area is too much inefficient !

οΏ½ 𝑃𝐴 π‘π‘˜ =π‘π‘œπ‘ πœƒπ‘˜β†’π‘˜βˆ’1

π‘Ÿ2𝑃𝑀 π‘π‘˜βˆ’1 β†’ π‘π‘˜ =

𝐺 π‘π‘˜β†”π‘π‘˜βˆ’1 𝑃𝑀 π‘π‘˜βˆ’1β†’π‘π‘˜π‘π‘œπ‘ πœƒπ‘˜βˆ’1β†’π‘˜

οΏ½ Dropping this term in, we have the following equation:

�𝑇𝑛 𝑝1 β†’ 𝑝0 =

1𝑁 𝑖=1𝑁

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 𝐺 𝑝𝑖,π‘˜β†”π‘π‘–,π‘˜βˆ’1

𝑃𝐴 𝑝𝑖,0 𝑃𝐴 𝑝𝑖,1 𝑃𝐴 𝑝𝑖,2 …𝑃𝐴 𝑝𝑖,𝑛

= 1𝑁 𝑖=1𝑁 𝐿𝑒 𝑝𝑖,𝑛 β†’ 𝑝𝑖,π‘›βˆ’1 π‘˜=2π‘˜=𝑛

𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 π‘π‘œπ‘ πœƒπ‘–,π‘˜βˆ’1β†’π‘˜π‘π‘€(𝑝𝑖,π‘˜βˆ’1→𝑝𝑖,π‘˜)

Page 33: Classical methods in offline rendering

Tricks

οΏ½ 𝑇𝑛 𝑝1 β†’ 𝑝0 can reuse the existing path of π‘‡π‘›βˆ’1 𝑝1 β†’ 𝑝0 , then only one vertex is needed to be sampled to evaluate each T.

�𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 π‘π‘œπ‘ πœƒπ‘–,π‘˜βˆ’1β†’π‘˜

𝑝𝑀(𝑝𝑖,π‘˜βˆ’1→𝑝𝑖,π‘˜)can be computed incrementally.

οΏ½ Use Multiple Importance Sampling to sample both of light source and bsdf, instead of trying to hit light source by chance, or:οΏ½ It won’t work for delta lights.

οΏ½ Terrible convergence rate if light source is small

Page 34: Classical methods in offline rendering

Path Tracing Conclusion

οΏ½ Unbiased, easy to implement, RobustοΏ½ Convergence rate may be low for certain

scenes, No Caustics

Page 35: Classical methods in offline rendering

Instant Radiosity

οΏ½ Distribute virtual point light in the first stage.

οΏ½ Use those virtual point light to evaluate the radiance

Page 36: Classical methods in offline rendering

PDF of a path in Instant Radiosity

οΏ½ Again, we assume 𝑃 𝑝0 and 𝑃 𝑝1 are both 1.

οΏ½ 𝑃𝐴 π‘π‘˜ =π‘π‘œπ‘ πœƒπ‘˜βˆ’1β†’π‘˜

π‘Ÿ2𝑃𝑀 π‘π‘˜ β†’ π‘π‘˜βˆ’1 =

𝐺 π‘π‘˜β†”π‘π‘˜βˆ’1 𝑃𝑀 π‘π‘˜β†’π‘π‘˜βˆ’1π‘π‘œπ‘ πœƒπ‘˜β†’π‘˜βˆ’1

οΏ½ The above equation only works for vertices from 2 to n-1, we already have the pdf w.r.t area of sampling vertex on light sources, since that’s exactly what we do.

οΏ½ Again, dropping it in, we have:

οΏ½

𝑇𝑛 𝑝1 β†’ 𝑝0 =1𝑁 𝑖=1𝑁

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 𝐺 𝑝𝑖,π‘˜β†”π‘π‘–,π‘˜βˆ’1

𝑃𝐴 𝑝𝑖,0 𝑃𝐴 𝑝𝑖,1 𝑃𝐴 𝑝𝑖,2 …𝑃𝐴(𝑝𝑖,𝑛)

= 1𝑁 𝑖=1𝑁 (

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘π‘œπ‘ πœƒπ‘–,π‘›β†’π‘›βˆ’1𝑃𝑀 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 𝑃𝐴(𝑝𝑖,𝑛)

π‘˜=4π‘˜=𝑛𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 π‘π‘œπ‘ πœƒπ‘–,π‘˜βˆ’1β†’π‘˜βˆ’2

𝑝𝑀(𝑝𝑖,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2)

𝑓 𝑝𝑖,2 β†’ 𝑝𝑖,1 β†’ 𝑝𝑖,0 𝐺 𝑝𝑖,2 ↔ 𝑝𝑖,3 𝑓 𝑝𝑖,3 β†’ 𝑝𝑖,2 β†’ 𝑝𝑖,1 )

Page 37: Classical methods in offline rendering

LTE Evaluation

οΏ½

𝑇𝑛 𝑝1 β†’ 𝑝0 =1𝑁 𝑖=1𝑁

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 𝐺 𝑝𝑖,π‘˜β†”π‘π‘–,π‘˜βˆ’1

𝑃𝐴 𝑝𝑖,0 𝑃𝐴 𝑝𝑖,1 𝑃𝐴 𝑝𝑖,2 …𝑃𝐴(𝑝𝑖,𝑛)

= 1𝑁 𝑖=1𝑁 (

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘π‘œπ‘ πœƒπ‘–,π‘›β†’π‘›βˆ’1𝑃𝑀 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 𝑃𝐴(𝑝𝑖,𝑛)

π‘˜=4π‘˜=𝑛𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 π‘π‘œπ‘ πœƒπ‘–,π‘˜βˆ’1β†’π‘˜βˆ’2

𝑝𝑀(𝑝𝑖,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2)

𝑓 𝑝𝑖,2 β†’ 𝑝𝑖,1 β†’ 𝑝𝑖,0 𝐺 𝑝𝑖,2 ↔ 𝑝𝑖,3 𝑓 𝑝𝑖,3 β†’ 𝑝𝑖,2 β†’ 𝑝𝑖,1 )

οΏ½ The green part will be evaluated incrementally in the VPL distribution stage.

οΏ½ The red part is done during per pixel radiance evaluation.

Page 38: Classical methods in offline rendering

Quite different way of converging

Page 39: Classical methods in offline rendering

Special Case Handling

οΏ½ See the hotspot at corners, it is caused by the inverse distance in G term.

οΏ½ Clamp the inverse distance to avoid it.οΏ½ 𝐺 = min 𝐺, πΊπ‘π‘™π‘Žπ‘šπ‘ + max(𝐺 βˆ’ πΊπ‘π‘™π‘Žπ‘šπ‘, 0)

οΏ½ Evaluate the red part by using other methods, like path tracing.

Page 40: Classical methods in offline rendering

Instant Radiosity Conclusion

οΏ½ Unbiased, easy to implement

οΏ½ Relatively slow convergence rate, almost no specular surface reflection

οΏ½ Not very practical unless with much enhancement

Page 41: Classical methods in offline rendering

Light Tracing

οΏ½ Trace rays from light source

οΏ½ Inefficient most of the time

Page 42: Classical methods in offline rendering

The reverse of Path Tracing

οΏ½ W is importance function.

οΏ½π‘Šπ‘œ 𝑝,π‘€π‘œ = π‘Šπ‘’ 𝑝,π‘€π‘œ + βˆ«π‘Šπ‘– 𝑝,𝑀𝑖 𝑓 𝑝,𝑀𝑖, π‘€π‘œ cosπœƒπ‘–π‘‘π‘€π‘–

Page 43: Classical methods in offline rendering

More than a Pixel

οΏ½ What is stored in a pixel, radiance?

�𝐼𝑗 = ∫𝐴0 βˆ«π‘Šπ‘’ 𝑝0, πœ” 𝐿𝑖 𝑝1,βˆ’πœ” π‘π‘œπ‘ πœƒ 𝑑𝑝0π‘‘πœ”

= βˆ«βˆ«π‘Šπ‘’ 𝑝0 β†’ 𝑝1 𝐿𝑖 𝑝1 β†’ 𝑝0 𝐺 𝑝0 ↔ 𝑝1 𝑑𝑝0𝑑𝑝1

οΏ½ Drop LTE in it, we have the equation for the radiance contribution of a specific length:

οΏ½ 𝐼𝑗 = βˆ«β€¦βˆ«π‘Šπ‘’ 𝑝0 β†’ 𝑝1 𝐺 𝑝0 ↔ 𝑝1 𝐿𝑒 𝑝𝑛 β†’ π‘π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝐺 𝑝𝑖,π‘˜ ↔ 𝑝𝑖,π‘˜βˆ’1* 𝑓 𝑝𝑖,π‘˜ β†’ 𝑝𝑖,π‘˜βˆ’1 β†’ 𝑝𝑖,π‘˜βˆ’2 𝑑𝑝0𝑑𝑝1 …𝑑𝑝𝑛

Page 44: Classical methods in offline rendering

PDF of sampling a path of n+1 vertices

οΏ½ 𝑃𝐴 π‘π‘˜ =π‘π‘œπ‘ πœƒπ‘˜β†’π‘˜+1

π‘Ÿ2𝑃𝑀 π‘π‘˜+1 β†’ π‘π‘˜ =

𝐺 π‘π‘˜β†”π‘π‘˜+1 𝑃𝑀 π‘π‘˜+1β†’π‘π‘˜π‘π‘œπ‘ πœƒπ‘˜+1β†’π‘˜

οΏ½

𝑇𝑛 𝑝1 β†’ 𝑝0 =1𝑁 𝑖=1𝑁

π‘Šπ‘’ 𝑝𝑖,0→𝑝𝑖,1 𝐺 𝑝𝑖,0↔𝑝𝑖,1 𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘˜=2π‘˜=𝑛 𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 𝐺 𝑝𝑖,π‘˜β†”π‘π‘–,π‘˜βˆ’1

𝑃𝐴 𝑝𝑖,0 𝑃𝐴 𝑝𝑖,1 𝑃𝐴 𝑝𝑖,2 …𝑃𝐴 𝑝𝑖,𝑛

= 1𝑁 𝑖=1𝑁

𝐿𝑒 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 π‘π‘œπ‘ πœƒπ‘–,π‘›β†’π‘›βˆ’1𝑃𝐴 𝑝𝑖,𝑛 𝑃𝑀 𝑝𝑖,𝑛→𝑝𝑖,π‘›βˆ’1 𝑃𝐴(𝑝𝑖,0)

𝐺 𝑝𝑖,0 ↔ 𝑝𝑖,1 π‘Šπ‘’ 𝑝𝑖,0 β†’ 𝑝𝑖,1

𝑓(𝑝𝑖,0 β†’ 𝑝𝑖,1 β†’ 𝑝𝑖,2) π‘˜=3π‘˜=𝑛𝑓 𝑝𝑖,π‘˜β†’π‘π‘–,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2 π‘π‘œπ‘ πœƒπ‘–,π‘˜βˆ’1β†’π‘˜βˆ’2

𝑝𝑀(𝑝𝑖,π‘˜βˆ’1→𝑝𝑖,π‘˜βˆ’2)

Page 45: Classical methods in offline rendering

Light Tracing vs Path Tracing

Page 46: Classical methods in offline rendering

Light Tracing Conclusion

οΏ½ Easy to implement, good caustics

οΏ½ Low convergence rate, especially for larger scene. Almost no specular surfaces.

Page 47: Classical methods in offline rendering

Light Tracing Conclusion

οΏ½ Good at rendering caustics for small scene

οΏ½ Terrible convergence rate for outdoor scene

οΏ½ Specular or highly glossy surfaces need special treatment

Page 48: Classical methods in offline rendering

Bidirectional Path Tracing

οΏ½ Shooting rays from both sides.

Page 49: Classical methods in offline rendering

Different Cases in BDPT

Page 50: Classical methods in offline rendering

All Cases in BDPT

οΏ½ Path Tracing Case, no vertex sampled on light source.

οΏ½ Light Tracing Case, only one vertex sampled on aperture.

οΏ½ Direct Illumination Case, only one vertex sampled on light source

οΏ½ Common Case, sub-path from each side contains at least two vertices

Page 51: Classical methods in offline rendering

A NaΓ―ve BDPT Implementation

οΏ½ Works terrible, delivers no value at all.οΏ½ Almost wrong value for specular

surface

οΏ½ Caustics are a little bit dimmer

οΏ½ A lot of fireflies around corners

Page 52: Classical methods in offline rendering

With MIS in BDPT

οΏ½ Same amount of time

οΏ½ Much better result

οΏ½ Quite Robust

οΏ½ Shows everything!!

Page 53: Classical methods in offline rendering

Resources for further detail

οΏ½ Reference Implementation:οΏ½ https://github.com/JerryCao1985/SORT

οΏ½ My Tech Blog:οΏ½ https://agraphicsguy.wordpress.com/

Page 54: Classical methods in offline rendering

Q&A