Transcript
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


Recommended