Monte Carlo Integration for Image Synthesis Adapted from Thomas - - PowerPoint PPT Presentation

monte carlo integration for image synthesis
SMART_READER_LITE
LIVE PREVIEW

Monte Carlo Integration for Image Synthesis Adapted from Thomas - - PowerPoint PPT Presentation

Monte Carlo Integration for Image Synthesis Adapted from Thomas Funkhouser Princeton University C0S 526, Fall 2002 Main Sources Books Realistic Ray Tracing, Peter Shirley Realistic Image Synthesis Using Photon Mapping,


slide-1
SLIDE 1

Monte Carlo Integration for Image Synthesis

Adapted from… Thomas Funkhouser Princeton University C0S 526, Fall 2002

slide-2
SLIDE 2

Main Sources

  • Books
  • Realistic Ray Tracing, Peter Shirley
  • Realistic Image Synthesis Using Photon Mapping, Henrik Wann Jensen
  • Advanced Global Illumination, Dutre, Bekaert & Bala
  • Theses
  • Robust Monte Carlo Methods for Light Transport Simulation, Eric Veach
  • Mathematical Models and Monte Carlo Methods for Physically Based

Rendering, Eric La Fortune

  • Course Notes
  • Mathematical Models for Computer Graphics, Stanford, Fall 1997
  • State of the Art in Monte Carlo Methods for Realistic Image Synthesis,

Course 29, SIGGRAPH 2001

slide-3
SLIDE 3

Outline

  • Motivation
  • Monte Carlo integration
  • Monte Carlo path tracing
  • Variance reduction techniques
  • Sampling techniques
  • Conclusion
slide-4
SLIDE 4

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics

slide-5
SLIDE 5

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics Surface Eye Pixel x dA e) L(x L

S P

→ =

slide-6
SLIDE 6

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics

Surface Eye Light x

x’

dA x x G x x x)V x L( e x x x x f e) (x,x L ) w L(x,

S r e

) , ( ) , ( ) , , ( ′ ′ → ′ → → ′ + → =

slide-7
SLIDE 7

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics

dA x x G x x x)V x L( e x x x x f e) (x,x L ) w L(x,

S r e

) , ( ) , ( ) , , ( ′ ′ → ′ → → ′ + → =

  • Herf
slide-8
SLIDE 8

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics w d n w ) w (x, L w w x f ) w (x, L ) w (x, L

i r e

  • )

( ) , , (

′ ′ + =

Surface Eye Light x ω Surface ω’

slide-9
SLIDE 9

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics w d n w ) w (x, L w w x f ) w (x, L ) w (x, L

i r e

  • )

( ) , , (

′ ′ + =

Debevec

slide-10
SLIDE 10

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics w d n w ) w (x, L w w x f ) w (x, L ) w (x, L

i r e

  • )

( ) , , (

′ ′ + =

Diffuse Surface Eye Light x ω Specular Surface ω’

slide-11
SLIDE 11

Motivation

  • Rendering = integration

Antialiasing Soft shadows Indirect illumination Caustics w d n w ) w (x, L w w x f ) w (x, L ) w (x, L

i r e

  • )

( ) , , (

′ ′ + =

Jensen

slide-12
SLIDE 12

Challenge

  • Rendering integrals are difficult to evaluate

Multiple dimensions Discontinuities » Partial occluders » Highlights » Caustics

dA x x G x x x)V x L( e x x x x f e) (x,x L ) w L(x,

S r e

) , ( ) , ( ) , , ( ′ ′ → ′ → → ′ + → =

  • Drettakis
slide-13
SLIDE 13

Challenge

  • Rendering integrals are difficult to evaluate

Multiple dimensions Discontinuities » Partial occluders » Highlights » Caustics

dA x x G x x x)V x L( e x x x x f e) (x,x L ) w L(x,

S r e

) , ( ) , ( ) , , ( ′ ′ → ′ → → ′ + → =

  • Jensen
slide-14
SLIDE 14

Outline

  • Motivation
  • Monte Carlo integration
  • Monte Carlo path tracing
  • Variance reduction techniques
  • Sampling techniques
  • Conclusion
slide-15
SLIDE 15

Integration in 1D

x=1 f(x)

? ) (

1

  • =

dx x f

Slide courtesy of Peter Shirley

slide-16
SLIDE 16

We can approximate

x=1 f(x) g(x)

  • =

1 1

) ( ) ( dx x g dx x f

Slide courtesy of Peter Shirley

slide-17
SLIDE 17

Or we can average

x=1 f(x) E(f(x))

)) ( ( ) (

1

x f E dx x f =

  • Slide courtesy of

Peter Shirley

slide-18
SLIDE 18

Estimating the average

x1 f(x) xN

  • =

=

N i i

x f N dx x f

1 1

) ( 1 ) (

E(f(x))

Slide courtesy of Peter Shirley

slide-19
SLIDE 19

Other Domains

x=b f(x) < f >ab x=a

  • =

− =

N i i b a

x f N a b dx x f

1

) ( ) (

Slide courtesy of Peter Shirley

slide-20
SLIDE 20

Multidimensional Domains

  • Same ideas apply for integration over …

Pixel areas Surfaces Projected areas Directions Camera apertures Time Paths Surface Eye x

  • =

=

N i i UGLY

x f N dx x f

1

) ( 1 ) (

Pixel

slide-21
SLIDE 21

Outline

  • Motivation
  • Monte Carlo integration
  • Monte Carlo path tracing
  • Variance reduction techniques
  • Sampling techniques
  • Conclusion
slide-22
SLIDE 22

Monte Carlo Path Tracing

  • Integrate radiance

for each pixel by sampling paths randomly

Diffuse Surface Eye Light x Specular Surface

Pixel w d n w ) w (x, L w w x f ) w (x, L ) w (x, L

i r e

  • )

( ) , , (

′ ′ + =

slide-23
SLIDE 23

Pixel Sampling

slide-24
SLIDE 24

Simple Stochastic Ray Tracing

slide-25
SLIDE 25

Radiance Sampling

  • Monte Carlo approximation
  • but RHS has unknowns
slide-26
SLIDE 26

Simple Monte Carlo Path Tracer

  • Step 1: Choose a ray (x, y), (u, v), t; weight = 1
  • Step 2: Trace ray to find intersection with nearest surface
  • Step 3: Randomly decide whether to

compute emitted or reflected light

  • Step 3a: If emitted,

return weight * Le

  • Step 3b: If reflected,
  • weight *= reflectance
  • Generate ray in random direction
  • Go to step 2
slide-27
SLIDE 27

A Simple Algorithm

slide-28
SLIDE 28

Monte Carlo Path Tracing

  • Advantages

Any type of geometry (procedural, curved, ...) Any type of BRDF (specular, glossy, diffuse, ...) Samples all types of paths (L(SD)*E) Accuracy controlled at pixel level Low memory consumption Unbiased - error appears as noise in final image

  • Disadvantages

Slow convergence Noise in final image

slide-29
SLIDE 29

Monte Carlo Path Tracing

Big diffuse light source, 20 minutes

Jensen

slide-30
SLIDE 30

Monte Carlo Path Tracing

1000 paths/pixel

Jensen

slide-31
SLIDE 31

Variance

x1 xN E(f(x))

[ ]

2 1

))] ( ( ) ( [ )) ( ( x f E x f x f E Var

N i i −

=

=

slide-32
SLIDE 32

Variance

x1 xN E(f(x))

[ ] [ ]

) ( 1 )) ( ( x f Var N x f E Var =

Variance decreases with 1/N Error decreases with 1/sqrt(N)

slide-33
SLIDE 33

Outline

  • Motivation
  • Monte Carlo integration
  • Monte Carlo path tracing
  • Variance reduction techniques
  • Sampling techniques
  • Conclusion
slide-34
SLIDE 34

Variance

  • Problem: variance decreases with 1/N

x1 xN E(f(x)) More samples removes noise SLOWLY More samples removes noise SLOWLY

slide-35
SLIDE 35

Variance Reduction Techniques

  • Importance sampling
  • Stratified sampling
  • Metropolis sampling
  • Quasi-random
  • =

=

N i i

x f N dx x f

1 1

) ( 1 ) (

slide-36
SLIDE 36

Importance Sampling

  • Put more samples where f(x) is bigger

) ( ) ( 1 ) (

1 i i i N i i

x p x f Y Y N dx x f = =

  • =

x1 xN E(f(x))

slide-37
SLIDE 37

Importance Sampling

  • This is still “unbiased”

x1 xN E(f(x))

[ ]

Ω Ω

= = = dx x f dx x p x p x f dx x p x Y Y E

i

) ( ) ( ) ( ) ( ) ( ) (

for all N

slide-38
SLIDE 38

Importance Sampling

  • Zero variance if p(x) ~ f(x)

x1 xN E(f(x)) Less variance with better importance sampling

) ( 1 ) ( ) ( ) ( ) ( = = = = Y Var c x p x f Y x cf x p

i i i

slide-39
SLIDE 39

Stratified Sampling

  • Estimate subdomains separately

x1 xN Ek(f(x))

Arvo

slide-40
SLIDE 40

Stratified Sampling

  • This is still unbiased
  • =

=

= =

M k i i N i i N

F N N x f N F

1 1

1 ) ( 1

x1 xN Ek(f(x))

slide-41
SLIDE 41

Stratified Sampling

  • Less overall variance if less variance

in subdomains

[ ] [ ]

  • =

=

M k i i N

F Var N N F Var

1 2

1

x1 xN Ek(f(x))

slide-42
SLIDE 42

Outline

  • Motivation
  • Monte Carlo integration
  • Monte Carlo path tracing
  • Variance reduction techniques
  • Sampling techniques
  • Conclusion
slide-43
SLIDE 43

Basic Monte Carlo Path Tracer

  • Step 1: Choose a ray (x, y), (u, v), t
  • Step 2: Trace ray to find intersection with nearest surface
  • Step 3: Randomly decide whether to

compute emitted or reflected light

  • Step 3a: If emitted,

return weight * Le

  • Step 3b: If reflected,
  • weight *= reflectance
  • Generate ray in random direction
  • Go to step 2
slide-44
SLIDE 44

Sampling Techniques

  • Problem: how do we generate random

points/directions during path tracing?

Non-rectilinear domains Importance (BRDF) Stratified

Surface Eye x

slide-45
SLIDE 45

Generating Random Points

  • Uniform distribution:
  • Use random number generator

Probability 1 Ω

slide-46
SLIDE 46

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Probability 1 Ω

slide-47
SLIDE 47

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Cumulative Probability 1 Ω

slide-48
SLIDE 48

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Cumulative Probability 1 Ω

y

slide-49
SLIDE 49

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Cumulative Probability 1 Ω

y

slide-50
SLIDE 50

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Cumulative Probability 1 Ω

y x

slide-51
SLIDE 51

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Cumulative Probability 1 Ω

slide-52
SLIDE 52

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Probability 1 Ω

slide-53
SLIDE 53

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Probability 1 Ω x x x x x x x x x x

slide-54
SLIDE 54

Generating Random Points

  • Specific probability distribution:

Function inversion Rejection Metropolis Probability 1 Ω x x x x x x x x x x

slide-55
SLIDE 55

Combining Multiple PDFs

  • Balance heuristic

Use combination of samples generated for each PDF Number of samples for each PDF chosen by weights Near optimal

slide-56
SLIDE 56

Monte Carlo Path Tracing Image

2000 samples per pixel, 30 SGIs, 30 hours

Jensen

slide-57
SLIDE 57

Monte Carlo Extensions

  • Unbiased

Bidirectional path tracing Metropolis light transport

  • Biased, but consistent

Noise filtering Adaptive sampling Irradiance caching

slide-58
SLIDE 58

Monte Carlo Extensions

  • Unbiased

Bidirectional path tracing Metropolis light transport

  • Biased, but consistent

Noise filtering Adaptive sampling Irradiance caching

RenderPark

slide-59
SLIDE 59

Monte Carlo Extensions

  • Unbiased

Bidirectional path tracing Metropolis light transport

  • Biased, but consistent

Noise filtering Adaptive sampling Irradiance caching

Heinrich

slide-60
SLIDE 60

Monte Carlo Extensions

  • Unbiased

Bidirectional path tracing Metropolis light transport

  • Biased, but consistent

Noise filtering Adaptive sampling Irradiance caching Unfiltered Filtered

Jensen

slide-61
SLIDE 61

Monte Carlo Extensions

  • Unbiased

Bidirectional path tracing Metropolis light transport

  • Biased, but consistent

Noise filtering Adaptive sampling Irradiance caching Adaptive Fixed

Ohbuchi Ohbuchi

slide-62
SLIDE 62

Monte Carlo Extensions

  • Unbiased

Bidirectional path tracing Metropolis light transport

  • Biased, but consistent

Noise filtering Adaptive sampling Irradiance caching

Jensen

slide-63
SLIDE 63

Summary

  • Monte Carlo Integration Methods

Very general Good for complex functions with high dimensionality Converge slowly (but error appears as noise)

  • Conclusion

Preferred method for difficult scenes Noise removal (filtering) and irradiance caching (photon maps) used in practice

slide-64
SLIDE 64

More Information

  • Books
  • Realistic Ray Tracing, Peter Shirley
  • Realistic Image Synthesis Using Photon Mapping, Henrik Wann Jensen
  • Theses
  • Robust Monte Carlo Methods for Light Transport Simulation, Eric Veach
  • Mathematical Models and Monte Carlo Methods for Physically Based

Rendering, Eric La Fortune

  • Course Notes
  • Mathematical Models for Computer Graphics, Stanford, Fall 1997
  • State of the Art in Monte Carlo Methods for Realistic Image Synthesis,

Course 29, SIGGRAPH 2001