Realistic Image Synthesis - Path Tracing...Solution: Monte Carlo integration โข In general, with a single sample (primary estimator) ฮฉ ๐๐๐ฅ๐ฅ๐๐โ๐ฅ๐ฅ ๐๐๐ฅ๐ฅ
Post on 01-Sep-2020
2 Views
Preview:
Transcript
Realistic Image Synthesis
- Path Tracing -
Pascal Grittmann
Philipp SlusallekKarol Myszkowski
Gurprit Singh
What are we computing? โ The physical phenomenon
ยฉ Giuseppe Milo (CC-BY)
What are we computing? โ The mathematical formulationGiven:A point visible to the camera
Compute:Incident light from all directions, reflected to the camera
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!
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
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 ๐๐๐๐
๐๐๐๐๐๐๐๐
๐๐๐๐
๐๐
๐ฅ๐ฅ
โ๐๐๐๐
๐ฅ๐ฅ
โ๐๐๐๐
Challenges
โข Recursive high dimensional โข Discontinuities (object and shadow boundaries)
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
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 ๐๐๐๐
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)
Russian Roulette and Splitting
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
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
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/
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
Example: Direct illumination
Sampling projected solid angle4 eye rays per pixel100 shadow rays
Sampling light source area4 eye rays per pixel100 shadow rays
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
Importance Sampling the BSDF
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
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 ๐๐๐๐ ๐ผ๐ผ๐๐
ฮธโ๐๐๐๐
๐๐๐๐
๐๐๐๐๐๐
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
๐ผ๐ผ๐๐ฮธ
โ๐๐๐๐๐๐๐๐
๐๐๐๐๐๐
๐ง๐ง
๐๐โฒ
Next Event Estimation
Reduce variance by connecting to points on the light source
Sampling ๐๐๐๐ from the hemisphere
Sampling ๐๐๐๐ as a direction to a point on the light
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
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
๐๐ ๐ฅ๐ฅ,๐ฆ๐ฆ
๐ฆ๐ฆ
๐ฅ๐ฅ
๐๐
๐๐๐๐๐๐
How to select the light source
โข Total powerโข Uniformly โข Estimated unoccluded contributionโข Estimated occluded contribution (prepass)โข Clustering to support many lights
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
Multiple Importance Sampling (MIS)Veach & Guibas 1995
Combining multiple sampling techniques
โข Sampling the BSDF
โข Sampling the light surfacep(y)= cosฮธy/rxy
2
x
y
p(ฯ)= cosฮธx/ฯ
x
y
ฮธx
Both techniques perform well for different effects
Light surface BSDF MIS
Light surface BSDF MIS
How to combine them?
โข Form an affine combination of the estimators:
๏ฟฝ๐ก๐กโ๐๐
๏ฟฝ๐๐
๐๐๐ก๐ก
๐ค๐ค๐ก๐ก ๐ฅ๐ฅ๐ก๐ก,๐๐๐๐ ๐ฅ๐ฅ๐ก๐ก,๐๐
๐๐๐ก๐ก ๐๐๐ก๐ก ๐ฅ๐ฅ๐ก๐ก,๐๐
โข Theoretically, any weighting functions ๐ค๐ค๐ก๐ก ๐ฅ๐ฅ work, provided:โข ๐ค๐ค๐ก๐ก ๐ฅ๐ฅ = 0 if ๐๐๐ก๐ก ๐ฅ๐ฅ = 0โข โ๐ก๐ก ๐ค๐ค๐ก๐ก ๐ฅ๐ฅ = 1 โ๐ฅ๐ฅ
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
Balance heuristic
โข Provably good choice: minimizes upper bound of the variance
๐ค๐ค๐ก๐ก ๐ฅ๐ฅ =๐๐๐ก๐ก๐๐๐ก๐ก ๐ฅ๐ฅ
โ๐๐ ๐๐๐๐๐๐๐๐ ๐ฅ๐ฅ
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
Comparison โ Image of a light source on surfaces with different roughness
more diffusemore specular
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)
Putting it all together
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
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
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
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โฆ
top related