A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at...

32
A Theory of Monte Carlo A Theory of Monte Carlo Visibility Sampling Visibility Sampling oorthi UC Berkeley son Pixar (now at Google Pixar ouzezahrai Disney Research Zurich University

Transcript of A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at...

Page 1: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

A Theory of Monte Carlo A Theory of Monte Carlo Visibility SamplingVisibility Sampling

Ravi Ramamoorthi UC BerkeleyJohn Anderson Pixar (now at Google)Mark Meyer PixarDerek Nowrouzezahrai Disney Research Zurich University of Montreal

Page 2: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

MotivationMotivation

Soft shadows critical in high quality rendering

Monte Carlo sampling of visibility most common

Which (non-adaptive) sampling patterns are better?

Theory of Monte Carlo visibility sampling Focus on (binary) visibility only; not general rendering

Page 3: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Monte Carlo Soft ShadowsMonte Carlo Soft Shadows

Light

Pixel

Page 4: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Experiment: Sampling StrategiesExperiment: Sampling Strategies

circle light uniform jitter RMS 6.6%

Page 5: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Experiment: Sampling StrategiesExperiment: Sampling Strategies

circle light stratified RMS 8.3%

Circle

Page 6: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Experiment: Sampling StrategiesExperiment: Sampling Strategies

square light uniform jitter RMS 13.4%

Page 7: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Experiment: Sampling StrategiesExperiment: Sampling Strategies

square light stratified RMS 10.4%

Page 8: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

ContributionsContributions

Theory of Visibility Sampling for Linear Lights

Uniform Jitter Sampling Lowest error at center of stratum (uniform sampling) Can avoid banding, keep low error with uniform jitter

2D Pixel-Light Fourier Analysis

Planar Area Lights

Page 9: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Previous WorkPrevious Work

Early MC Sampling [Cook 86, Mitchell 87,96, HK 94]

Empirical Study Linear Lights [Ouellette & Fiume 01]

Adaptive Sampling [Mitchell 91, Guo98] Adaptive Filtering [Hachisuka 08, …, this session] Shadow Coherence [Agrawala et al. 00, Egan et al. 11] Can leverage our approach

Signal Processing and Frequency Analysis Space-Angle [Durand et al. 05] Sheared Visibility Spectrum [Egan et al. 11] Fourier Analysis of MC [Ouellete & Fiume 01, Durand 11]

Page 10: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Linear Lights: DiscontinuitiesLinear Lights: Discontinuities

Visibility0

1

PixelBlocker

Light

Discontinuity

Single Discontinuity:Heaviside Function

Two Discontinuities:Boxcar Function

Many Discontinuities:Many Box Functions

Page 11: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Single Discontinuity: Uniform SamplingSingle Discontinuity: Uniform Sampling Error of Uniform Sampling

Error depends only on stratum of discontinuity

Error depends only on discontinuity location

Worst-Case, Variance (N = samples) Depends only on sample placement in stratum

Absolute Error

Uniform Sampling

Visibility at Pixel

Page 12: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Single Discontinuity: ErrorsSingle Discontinuity: Errors

Sample Location Worst-Case RMS Error Variance

End-pts of stratume.g., QMC Halton

Random (Jittered)Stratified Sampling

Center (Uniform)

Uniform Sampling is optimal (but bands, bias)

Reduces variance by factor of 2 vs. stratified

Benefits of uniform without banding? Stratified best unbiased method for 1 discontinuity, but…

Page 13: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Two Discontinuities: Boxcar Two Discontinuities: Boxcar

Assume discontinuities in different strata For very complex visibility, stratification not useful anyway

Visibility0

1

Strata

V0

1

Ground truth net visibility = 0.75 + 0.75 = 1.5

Uniform Sampling: net visibility = 1+1 = 2, biasedStratified Sampling: net vis 00 / 01 / 10 / 11 = 0,1,2, high variance

Page 14: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Two Discontinuities: ErrorsTwo Discontinuities: Errors

Sampling Method Worst-Case RMS Error Variance

Stratified

Uniform Jitter

Uniform

Uniform Jitter exploits correlation of discontinuities Error stays the same as in the single discontinuity case While other methods (stratified) double the variance Multiple discontinuities: separate into individual box functions

Uniform Jitter has same variance as uniform Optimal with no bias or banding

Page 15: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Linear Light: UniformLinear Light: Uniform

Error Image (scaled up)Uniform 16 samples

3.97% RMS Error (best)Uniform causes banding

Page 16: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Linear Light: Uniform JitterLinear Light: Uniform Jitter

Error Image (scaled up)Uniform Jitter 16 samples

4.21% RMS ErrorNo banding, low error

Page 17: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Linear Light: StratifiedLinear Light: Stratified

Error Image (scaled up)Stratified 16 samples

5.36% RMS Error (worst)

Page 18: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

2D Pixel Light Fourier Analysis2D Pixel Light Fourier Analysis

Fourier analysis for fixed depth blocker

Shadow spectrum line in pixel-light space

Wedge if blockers at multiple depths [Egan 2011]

Builds on [Egan 2011] and Fourier analysis of Monte Carlo [Durand 2011] but full pixel-light theory

Blocker

Receiver

Light

x

y

x

yOcclusion

Visibility Spatial Domain Fourier DomainΩx

Ωy

Page 19: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Fourier Analysis: Uniform SamplingFourier Analysis: Uniform Sampling

Sampling pattern same for all x in uniform sampling Fourier spectrum on vertical line, spacing depends on N

Product of visibility and sampling: Fourier convolution

Errors (only) when aliases touch spatial axis Banding since error concentrated in specific frequencies

Ωx

Ωy

Visibility Spectrum

Ωx

Ωy

Ωx

Ωy

Uniform Sampling Sampled Visibility

Page 20: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Fourier Analysis: Uniform JitterFourier Analysis: Uniform Jitter

Sampling pattern uniform spaced but jittered at each x Fourier spectrum dots for replicas become horizontal lines

Fourier convolution: Central spectrum plus noise

Errors diffused to entire spatial axis No banding: error not concentrated in specific frequencies

Ωx

Ωy

Visibility Spectrum

Ωx

Ωy

Ωx

Ωy

Uniform Jitter Sampling Sampled Visibility

Page 21: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Planar Area LightsPlanar Area Lights Apply linear 1D analysis to each “scanline” of 2D light

But possible bad correlation between scanlines

Uniform Jitter StratifiedBlocked Visible

Samples Correlated Samples De-Correlated

Page 22: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Frequency Analysis: Shape of LightFrequency Analysis: Shape of Light

For one pixel, Fourier spectrum of visibility, light

Uniform Jitter is a regular comb pattern

Simple visibility lies on a line (assume horizontal)

Ωx

Ωy

Page 23: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Frequency Analysis: Shape of LightFrequency Analysis: Shape of Light

Integral of product of visibility and sampling pattern True in spatial or Fourier domain Ground Truth is constant (0 frequency) term only

Errors when significant spectral overlap

Ωx

Ωy

Page 24: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Frequency Analysis: Shape of LightFrequency Analysis: Shape of Light

Smooth lights (e.g., Gaussian, circular) Multiply light by Gaussian same as multiply sampling pattern Fourier: Convolve sampling pattern by Gaussian

Overlap now only along horizontal line, not full pattern

Ωx

Ωy

Page 25: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

ImplementationImplementation

Simple shaders in RenderMan (general RIB files)

NVIDIA Optix for real-time applications Sampling patterns in closest hit kernel

Practical Result: Uniform Jitter best published method to our knowledge for circle, linear lights

Page 26: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Grids: Circle Light: Stratified 20 Grids: Circle Light: Stratified 20

Page 27: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Grids: Circle Light: Uniform Jitter 20Grids: Circle Light: Uniform Jitter 20

Page 28: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Grids: Circle Light: Halton, Warp 25Grids: Circle Light: Halton, Warp 25

Page 29: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

Grids: Circle and Gaussian LightsGrids: Circle and Gaussian Lights

Comparable gain across all sample counts

Page 30: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

ConclusionConclusion

Comprehensive Theory of MC Visibility Sampling Linear (1D) Lights: Uniform Jitter is optimal Circular or Gaussian Light: Uniform Jitter is better Square Light: Uniform Jitter worse than Stratified Halton, blue noise do not perform better

Introduce new Statistical and Fourier approaches

Best sampling pattern depends on shape of light Can choose linear or circular instead of square lights

Practical gains of 20%-40% for almost no effort

Future analyses of Monte Carlo patterns Optimal pattern for planar lights still an open question

Page 31: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

AcknowledgmentsAcknowledgments

Rob Cook for inspiration, discussing 2D pixel-light

Fredo Durand for notes on Fourier Monte Carlo

Kevin Egan, Florian Hecht, Christophe Hery, Juan Buhler for scenes in the paper

Li-Yi Wei and Christophe Hery for discussions of blue noise and sampling methods respectively

Anonymous reviewers for many helpful suggestions

Page 32: A Theory of Monte Carlo Visibility Sampling Ravi Ramamoorthi UC Berkeley John Anderson Pixar (now at Google) Mark Meyer Pixar Derek Nowrouzezahrai Disney.

To Jim Arvo, 1956-2011To Jim Arvo, 1956-2011