realistic image synthesis - path tracing...solution: monte carlo integration โ€ข in general, with a...

1

Upload: others

Post on 01-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Realistic Image Synthesis

- Path Tracing -

Pascal Grittmann

Philipp SlusallekKarol Myszkowski

Gurprit Singh

Page 2: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

What are we computing? โ€“ The physical phenomenon

ยฉ Giuseppe Milo (CC-BY)

Page 3: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

What are we computing? โ€“ The mathematical formulationGiven:A point visible to the camera

Compute:Incident light from all directions, reflected to the camera

Page 4: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

What are we computing? โ€“ The mathematical formulationGiven:A point visible to the cameraprevious point

Compute:Incident light from all directions, reflected to the camera previous point

Recursive problem!

Page 5: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Reminder: Rendering Equation

๐ฟ๐ฟ๐‘œ๐‘œ ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘œ๐‘œ = ๐ฟ๐ฟ๐‘’๐‘’ ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘œ๐‘œ + ๏ฟฝฮฉ๐‘“๐‘“ ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘œ๐‘œ,๐œ”๐œ”๐‘–๐‘– ๐ฟ๐ฟ๐‘–๐‘– ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘–๐‘– cos ๐œƒ๐œƒ๐‘–๐‘– ๐‘‘๐‘‘๐œ”๐œ”๐‘–๐‘–

Outgoing radiance from ๐‘ฅ๐‘ฅ in direction ๐œ”๐œ”๐‘œ๐‘œ

Emitted radiance from ๐‘ฅ๐‘ฅ in direction ๐œ”๐œ”๐‘œ๐‘œ

Bidirectional scattering distribution function โ€“ BSDF (how much light is reflected

from ๐œ”๐œ”๐‘–๐‘– towards ๐œ”๐œ”๐‘œ๐‘œ? )

Incident radiance at ๐‘ฅ๐‘ฅfrom direction ๐œ”๐œ”๐‘–๐‘–

The mysterious cosine term

Integral over sphere of all directions

Page 6: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Why the cosine term?

โ€ข Definition of radiance: โ€ข โ€œflux per unit solid angle per unit

projected areaโ€

โ€ข We are interested in:โ€ข โ€œflux per unit solid angle per unit

projected areaโ€

cos ๐œƒ๐œƒ๐‘–๐‘–

๐œƒ๐œƒ๐‘–๐‘–๐œƒ๐œƒ๐‘–๐‘–

๐œ”๐œ”๐‘–๐‘–

๐‘›๐‘›

๐‘ฅ๐‘ฅ

โˆ’๐œ”๐œ”๐‘–๐‘–

๐‘ฅ๐‘ฅ

โˆ’๐œ”๐œ”๐‘–๐‘–

Page 7: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Challenges

โ€ข Recursive high dimensional โ€ข Discontinuities (object and shadow boundaries)

Page 8: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Solution: Monte Carlo integration

โ€ข In general, with a single sample (primary estimator)

๏ฟฝฮฉ๐‘“๐‘“ ๐‘ฅ๐‘ฅ ๐‘‘๐‘‘๐‘ฅ๐‘ฅ โ‰ˆ

๐‘“๐‘“ ๐‘ฅ๐‘ฅ๐‘๐‘ ๐‘ฅ๐‘ฅ

โ€ข Applied to rendering:

๐ฟ๐ฟ๐‘œ๐‘œ ๐‘ฅ๐‘ฅ1,๐œ”๐œ”๐‘œ๐‘œ โ‰ˆ ๐ฟ๐ฟ๐‘’๐‘’ ๐‘ฅ๐‘ฅ1,๐œ”๐œ”๐‘œ๐‘œ +๐‘“๐‘“ ๐‘ฅ๐‘ฅ1,๐œ”๐œ”๐‘œ๐‘œ,๐œ”๐œ”๐‘–๐‘– cos ๐œƒ๐œƒ๐‘–๐‘–

๐‘๐‘ ๐œ”๐œ”๐‘–๐‘–๐ฟ๐ฟ๐‘œ๐‘œ ๐‘ฅ๐‘ฅ2,โˆ’๐œ”๐œ”๐‘–๐‘–

Estimated recursively! High (infinite) dimensionality

๐‘ฅ๐‘ฅ1

๐‘ฅ๐‘ฅ2

Page 9: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

How to sample ๐œ”๐œ”๐‘–๐‘–?

โ€ข Ideally proportionally to the full integrandโ€ข ๐‘๐‘ ๐œ”๐œ”๐‘–๐‘– โˆ ๐‘“๐‘“ ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘œ๐‘œ,๐œ”๐œ”๐‘–๐‘– ๐ฟ๐ฟ๐‘–๐‘– ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘–๐‘– cos ๐œƒ๐œƒ๐‘–๐‘–

โ€ข Usually not possible Limit to one or more factorsโ€ข Simplest method: cosine

โ€ข ๐‘๐‘ ๐œ”๐œ”๐‘–๐‘– โˆ cos ๐œƒ๐œƒ๐‘–๐‘–โ€ข Often also possible (approximately, at least): BSDF times cosine

โ€ข ๐‘๐‘ ๐œ”๐œ”๐‘–๐‘– โˆ ๐‘“๐‘“ ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘œ๐‘œ,๐œ”๐œ”๐‘–๐‘– cos ๐œƒ๐œƒ๐‘–๐‘–

Page 10: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

When to terminate?

โ€ข In reality, all surfaces reflect lightโ€ข We cannot track infinitely long paths, need to terminate recursion at

some pointโ€ข Options:

โ€ข Maximum path length (biased)โ€ข Russian roulette (unbiased, later)

Page 11: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Russian Roulette and Splitting

Page 12: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Russian roulette

โ€ข Randomly terminate the path with some probability ๐‘๐‘โ€ข Unbiasedโ€ข Increases variance (i.e., noise in the image)

โ€ข Given an estimator ๐น๐น, replace by ๐น๐น๐‘…๐‘…๐‘…๐‘…:

with probability ๐‘๐‘

with probability (1 โˆ’ ๐‘๐‘)๐น๐น๐‘…๐‘…๐‘…๐‘… = ๏ฟฝ

1๐‘๐‘๐น๐น

0

Page 13: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

What criterion to use?

โ€ข Fixed probabilityโ€ข Current path throughputโ€ข Efficiency-optimized RR (Veach 97):

โ€ข Based on statistics of surrounding pixels

โ€ข โ€œAdjoint driven Russian roulette and splittingโ€ Vorba et al 201โ€ข Based on statistics from a pre-pass, combined with splitting

Page 14: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Russian roulette experimentsinput scene path depth < 11 path depth < 101

RR with p=0.3 efficiency optimized p = throughput / 0.01

32.6min

53.2min

28.8min

10.6min

Thiago Ize (University of Utah, currently Solid Angle)http://www.cs.utah.edu/~thiago/cs7650/hw12/

Page 15: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Splitting

โ€ข Use more samples for the next recursion than the current oneโ€ข Often done at the first point (the one visible to the camera)โ€ข Trade off: anti-aliasing vs variance

No splitting Splitting

Page 16: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Example: Direct illumination

Sampling projected solid angle4 eye rays per pixel100 shadow rays

Sampling light source area4 eye rays per pixel100 shadow rays

Page 17: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Example: Splitting for direct illumination

Stratified random sample locations4 eye rays per pixel

16 shadow ray

Stratified random sample locations64 eye rays per pixel

1 shadow ray

Page 18: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Importance Sampling the BSDF

Page 19: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Simplest method: cosine hemisphere samplingโ€ข PDF proportional to the cosine:

โ€ข ๐‘๐‘ ๐œ”๐œ”๐‘–๐‘– = cos ๐œƒ๐œƒ๐‘–๐‘–๐œ‹๐œ‹

โ€ข Ideal for diffuse surfaces

โ€ข Given two uniform samples ๐‘ข๐‘ข1,๐‘ข๐‘ข2:โ€ข ๐œ™๐œ™๐‘–๐‘– = 2๐œ‹๐œ‹๐‘ข๐‘ข1โ€ข ๐œƒ๐œƒ๐‘–๐‘– = cosโˆ’1 ๐‘ข๐‘ข2โ€ข (Derivation in Assignment 3)

ยฉ William Sherif

Page 20: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Example: Phong BRDF

โ€ข Simple glossy BRDFโ€ข Multiplies by a cosine lobe around the perfect reflection

๐‘“๐‘“ ๐‘ฅ๐‘ฅ,๐œ”๐œ”๐‘œ๐‘œ,๐œ”๐œ”๐‘–๐‘– =๐‘›๐‘› + 22๐œ‹๐œ‹

cos๐‘›๐‘› ๐›ผ๐›ผ๐‘Ÿ๐‘Ÿ

โ€ข ๐›ผ๐›ผ๐‘Ÿ๐‘Ÿ is the angle formed by ๐œ”๐œ”๐‘–๐‘– and ๐œ”๐œ”๐‘Ÿ๐‘Ÿโ€ข ๐œ”๐œ”๐‘Ÿ๐‘Ÿ is the prefect reflection of ๐œ”๐œ”๐‘œ๐‘œ ๐›ผ๐›ผ๐‘Ÿ๐‘Ÿ

ฮธโˆ’๐œ”๐œ”๐‘œ๐‘œ

๐œ”๐œ”๐‘Ÿ๐‘Ÿ

๐œ”๐œ”๐‘–๐‘–๐‘›๐‘›

Page 21: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Sampling the cosine lobe

โ€ข Step 1: sample the cosine lobe about ๐‘ง๐‘ง axis โ€ข ๐‘๐‘ ๐œ”๐œ”โ€ฒ = cos๐‘›๐‘› ๐œƒ๐œƒโ€ฒ ๐‘›๐‘›+1

2๐œ‹๐œ‹

โ€ข Step 2: compute ๐œ”๐œ”๐‘Ÿ๐‘Ÿโ€ข Reflect ๐œ”๐œ”๐‘œ๐‘œ about ๐‘›๐‘›

โ€ข Step 3: transform ๐œ”๐œ”โ€ฒ to coordinate system where ๐œ”๐œ”๐‘Ÿ๐‘Ÿ is the ๐‘ง๐‘ง axisโ€ข Matrix multiplication

๐›ผ๐›ผ๐‘Ÿ๐‘Ÿฮธ

โˆ’๐œ”๐œ”๐‘œ๐‘œ๐œ”๐œ”๐‘Ÿ๐‘Ÿ

๐œ”๐œ”๐‘–๐‘–๐‘›๐‘›

๐‘ง๐‘ง

๐œ”๐œ”โ€ฒ

Page 22: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Next Event Estimation

Page 23: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Reduce variance by connecting to points on the light source

Sampling ๐œ”๐œ”๐‘–๐‘– from the hemisphere

Sampling ๐œ”๐œ”๐‘–๐‘– as a direction to a point on the light

Page 24: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

But it is a point, not a directionโ€ฆ

โ€ข We sample a direction ๐œ”๐œ”๐‘–๐‘– by sampling a point ๐‘ฆ๐‘ฆ on the lightโ€ข With some pdf ๐‘๐‘ ๐‘ฆ๐‘ฆ defined on the surface area of the lightโ€ข But our integral is over the (hemi-) sphereโ€ข We need to perform a change of variables

Page 25: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

From surface area to hemisphere

โ€ข Projected unit surface area at the light sourceโ€ข cos ๐œƒ๐œƒ๐‘ฆ๐‘ฆ

โ€ข Compute surface area on unit hemisphereโ€ข Similar triangles 1

๐‘‘๐‘‘

โ€ข 2D 1๐‘‘๐‘‘2

โ€ข We must also account for the visibility!โ€ข ๐‘‰๐‘‰ ๐‘ฅ๐‘ฅ,๐‘ฆ๐‘ฆ

โ€ข Result: cos ๐œƒ๐œƒ๐‘ฆ๐‘ฆ๐‘‘๐‘‘2

๐‘‰๐‘‰ ๐‘ฅ๐‘ฅ,๐‘ฆ๐‘ฆ

๐‘ฆ๐‘ฆ

๐‘ฅ๐‘ฅ

๐‘›๐‘›

๐‘‘๐‘‘๐œ”๐œ”๐‘–๐‘–

Page 26: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

How to select the light source

โ€ข Total powerโ€ข Uniformly โ€ข Estimated unoccluded contributionโ€ข Estimated occluded contribution (prepass)โ€ข Clustering to support many lights

Page 27: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

What if a BSDF sample hits the light

โ€ข Cannot count both: would yield twice the actual value!โ€ข Could average both and divide by two high varianceโ€ข Or: use MIS

Page 28: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Multiple Importance Sampling (MIS)Veach & Guibas 1995

Page 29: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Combining multiple sampling techniques

โ€ข Sampling the BSDF

โ€ข Sampling the light surfacep(y)= cosฮธy/rxy

2

x

y

p(ฯ‰)= cosฮธx/ฯ€

x

y

ฮธx

Page 30: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Both techniques perform well for different effects

Light surface BSDF MIS

Light surface BSDF MIS

Page 31: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

How to combine them?

โ€ข Form an affine combination of the estimators:

๏ฟฝ๐‘ก๐‘กโˆˆ๐‘‡๐‘‡

๏ฟฝ๐‘—๐‘—

๐‘›๐‘›๐‘ก๐‘ก

๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅ๐‘ก๐‘ก,๐‘—๐‘—๐‘“๐‘“ ๐‘ฅ๐‘ฅ๐‘ก๐‘ก,๐‘—๐‘—

๐‘›๐‘›๐‘ก๐‘ก ๐‘๐‘๐‘ก๐‘ก ๐‘ฅ๐‘ฅ๐‘ก๐‘ก,๐‘—๐‘—

โ€ข Theoretically, any weighting functions ๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅ work, provided:โ€ข ๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅ = 0 if ๐‘๐‘๐‘ก๐‘ก ๐‘ฅ๐‘ฅ = 0โ€ข โˆ‘๐‘ก๐‘ก ๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅ = 1 โˆ€๐‘ฅ๐‘ฅ

Page 32: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

First, all densities need to be in the same measureโ€ข ๐‘๐‘ ๐œ”๐œ” = cos ๐œƒ๐œƒ

๐œ‹๐œ‹has unit ๐‘ ๐‘ ๐‘Ÿ๐‘Ÿโˆ’1 (density on the hemisphere)

โ€ข ๐‘๐‘ ๐‘ฆ๐‘ฆ has unit ๐‘š๐‘šโˆ’2 (density on surface area)

โ€ข Applying the same logic as before, we can transform them:

โ€ข ๐‘๐‘ ๐‘ฆ๐‘ฆ|๐œ”๐œ” = cos ๐œƒ๐œƒ๐œ‹๐œ‹

cos ๐œƒ๐œƒ๐‘ฆ๐‘ฆ๐‘‘๐‘‘2

Page 33: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Balance heuristic

โ€ข Provably good choice: minimizes upper bound of the variance

๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅ =๐‘›๐‘›๐‘ก๐‘ก๐‘๐‘๐‘ก๐‘ก ๐‘ฅ๐‘ฅ

โˆ‘๐‘˜๐‘˜ ๐‘›๐‘›๐‘˜๐‘˜๐‘๐‘๐‘˜๐‘˜ ๐‘ฅ๐‘ฅ

Page 34: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Power, maximum, and cuttoff heuristics

โ€ข Can sometimes perform better for low-variance techniquesโ€ข Amplify the weights to remove residual noise from โ€œbadโ€ techniques

โ€ข Maximum: only consider technique with largest ๐‘›๐‘›๐‘ก๐‘ก๐‘๐‘๐‘ก๐‘ก ๐‘ฅ๐‘ฅโ€ข Cutoff: Balance, but set ๐‘›๐‘›๐‘ก๐‘ก๐‘๐‘๐‘ก๐‘ก ๐‘ฅ๐‘ฅ to zero if below some threshold

โ€ข Power heuristic: ๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅ = ๐‘›๐‘›๐‘ก๐‘ก๐‘๐‘๐‘ก๐‘ก ๐‘ฅ๐‘ฅ2

โˆ‘๐‘˜๐‘˜ ๐‘›๐‘›๐‘˜๐‘˜๐‘๐‘๐‘˜๐‘˜ ๐‘ฅ๐‘ฅ 2

Page 35: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Comparison โ€“ Image of a light source on surfaces with different roughness

more diffusemore specular

Page 36: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Optimal weights

โ€ข It is possible to derive the optimal set of functions ๐‘ค๐‘ค๐‘ก๐‘ก ๐‘ฅ๐‘ฅโ€ข Result: linear system involving many integralsโ€ข Kondapaneni et al 2019โ€ข (Our recent SIGGRAPH paper)

Page 37: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Putting it all together

Page 38: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

A less basic path tracer

โ€ข Given a point visible to the cameraโ€ข (1) Compute direct illumination

โ€ข Select light source and point on the lightโ€ข Trace a shadow ray for ๐‘‰๐‘‰ ๐‘ฅ๐‘ฅ,๐‘ฆ๐‘ฆโ€ข Sample BSDF and check if a light was intersectedโ€ข Compute MIS weights and add estimate

Page 39: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

A less basic path tracer

โ€ข Given a point visible to the cameraโ€ข (1) Compute direct illumination

โ€ข Select light source and point on the lightโ€ข Trace a shadow ray for ๐‘‰๐‘‰ ๐‘ฅ๐‘ฅ,๐‘ฆ๐‘ฆโ€ข Sample BSDF and check if a light was intersectedโ€ข Compute MIS weights and add estimate

โ€ข (2) Terminate with Russian roulette

Page 40: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

A less basic path tracer

โ€ข Given a point visible to the cameraโ€ข (1) Compute direct illumination

โ€ข Select light source and point on the lightโ€ข Trace a shadow ray for ๐‘‰๐‘‰ ๐‘ฅ๐‘ฅ,๐‘ฆ๐‘ฆโ€ข Sample BSDF and check if a light was intersectedโ€ข Compute MIS weights and add estimate

โ€ข (2) Terminate with Russian rouletteโ€ข (3) Continue the path

โ€ข Could sample a new direction from the BSDF, or re-use the one from (1)

โ€ข Go back to (1), repeat until RR terminates

Page 41: Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โ€ข In general, with a single sample (primary estimator) ฮฉ ๐‘“๐‘“๐‘ฅ๐‘ฅ๐‘‘๐‘‘โ‰ˆ๐‘ฅ๐‘ฅ ๐‘“๐‘“๐‘ฅ๐‘ฅ

Many improvements possible

โ€ข Splitting (e.g., at first intersection)โ€ข Combine multiple light sampling strategies (via MIS)โ€ข Store statistics to approximate ๐ฟ๐ฟ๐‘–๐‘– for importance sampling (โ€œguidingโ€,

later)โ€ข And so onโ€ฆ