Biased Monte Carlo Ray Tracing Filtering, Irradiance Caching, and - - PowerPoint PPT Presentation

biased monte carlo ray tracing
SMART_READER_LITE
LIVE PREVIEW

Biased Monte Carlo Ray Tracing Filtering, Irradiance Caching, and - - PowerPoint PPT Presentation

Biased Monte Carlo Ray Tracing Filtering, Irradiance Caching, and Photon Mapping Henrik Wann Jensen Stanford University May 23, 2002 Unbiased and Consistent Unbiased estimator: E { X } = . . . Consistent estimator: N E


slide-1
SLIDE 1

Biased Monte Carlo Ray Tracing

Filtering, Irradiance Caching, and Photon Mapping

→ Henrik Wann Jensen

Stanford University May 23, 2002

slide-2
SLIDE 2

Unbiased and Consistent

Unbiased estimator: E{X} =

  • . . .

Consistent estimator: lim

N→∞ E{X} →

  • . . .
slide-3
SLIDE 3

Unbiased and Consistent

Unbiased estimator: 1 N

N

  • i=1

f(ξi) Consistent estimator: 1 N + 1

N

  • i=1

f(ξi)

slide-4
SLIDE 4

Unbiased Methods

  • Variance (noise) is the only error
  • This error can be analyzed using the variance (i.e.

95% of samples are within 2% of the correct result)

slide-5
SLIDE 5

Path Tracing (Unbiased)

10 paths/pixel

slide-6
SLIDE 6

Path Tracing (Unbiased)

10 paths/pixel

slide-7
SLIDE 7

Path Tracing (Unbiased)

100 paths/pixel

slide-8
SLIDE 8

How Can We Remove This Noise

slide-9
SLIDE 9

The World is Diffuse!

Arnold Rendering

slide-10
SLIDE 10

The World is Diffuse!

Arnold Rendering

slide-11
SLIDE 11

The World is Diffuse!

Arnold Rendering

slide-12
SLIDE 12

Noise Reduction/Removal

  • More samples (slow convergence, σ ∝ 1/

√ N)

slide-13
SLIDE 13

Noise Reduction/Removal

  • More samples (slow convergence, σ ∝ 1/

√ N)

  • Better sampling (stratified, importance, qmc etc.)
slide-14
SLIDE 14

Noise Reduction/Removal

  • More samples (slow convergence, σ ∝ 1/

√ N)

  • Better sampling (stratified, importance, qmc etc.)
  • Adaptive sampling
slide-15
SLIDE 15

Noise Reduction/Removal

  • More samples (slow convergence, σ ∝ 1/

√ N)

  • Better sampling (stratified, importance, qmc etc.)
  • Adaptive sampling
  • Filtering
slide-16
SLIDE 16

Noise Reduction/Removal

  • More samples (slow convergence, σ ∝ 1/

√ N)

  • Better sampling (stratified, importance, qmc etc.)
  • Adaptive sampling
  • Filtering
  • Caching and interpolation
slide-17
SLIDE 17

Stratified Sampling

Latin Hypercube: 10 paths/pixel

slide-18
SLIDE 18

Quasi Monte-Carlo

Halton-Sequence: 10 paths/pixel

slide-19
SLIDE 19

Fixed (Random) Sequence

10 paths/pixel

slide-20
SLIDE 20

Filtering: Idea

  • Noise is high frequency
slide-21
SLIDE 21

Filtering: Idea

  • Noise is high frequency
  • Remove high frequency content
slide-22
SLIDE 22

Unfiltered Image

10 paths/pixel

slide-23
SLIDE 23

3x3 Lowpass Filter

10 paths/pixel

slide-24
SLIDE 24

Unfiltered Image

10 paths/pixel

slide-25
SLIDE 25

3x3 Median Filter

10 paths/pixel

slide-26
SLIDE 26

Energy Preserving Filters

slide-27
SLIDE 27

Energy Preserving Filters

  • Distribute noisy energy over several pixels
slide-28
SLIDE 28

Energy Preserving Filters

  • Distribute noisy energy over several pixels
  • Adaptive filter width

[Rushmeier and Ward 94]

  • Diffusion style filters

[McCool99]

  • Splatting style filters

[Suykens and Willems 00]

slide-29
SLIDE 29

Problems With Filtering

  • Everything is filtered (blurred)

⋆ Textures ⋆ Highlights ⋆ Caustics ⋆ . . .

slide-30
SLIDE 30

Caching Techniques

slide-31
SLIDE 31

Caching Techniques

Irradiance caching : Compute irradiance at selected points and inter- polate. Photon mapping : Trace ‘‘photons’’ from the lights and store them in a photon map, that can be used during rendering.

slide-32
SLIDE 32

Box: Direct Illlumination

slide-33
SLIDE 33

Box: Global Illlumination

slide-34
SLIDE 34

Box: Indirect Irradiance

slide-35
SLIDE 35

Irradiance Caching: Idea

‘‘A Ray Tracing Solution for Diffuse Interreflection’’. Greg Ward, Francis Rubinstein and Robert Clear:

  • Proc. SIGGRAPH’88.

Idea: Irradiance changes slowly → interpolate.

slide-36
SLIDE 36

Irradiance Sampling

E(x) =

L′(x, ω′) cos θ dω′

slide-37
SLIDE 37

Irradiance Sampling

E(x) =

L′(x, ω′) cos θ dω′ = 2π π/2 L′(x, θ, φ) cos θ sin θ dθ dφ

slide-38
SLIDE 38

Irradiance Sampling

E(x) =

L′(x, ω′) cos θ dω′ = 2π π/2 L′(x, θ, φ) cos θ sin θ dθ dφ ≈ π TP

T

  • t=1

P

  • p=1

L′(θt, φp) θt = sin−1

  • t−ξ

T

  • and φp = 2πp−ψ

P

slide-39
SLIDE 39

Irradiance Change

ǫ(x) ≤

  • ∂E

∂x (x − x0) + ∂E ∂θ (θ − θ0)

  • position
  • rotation
slide-40
SLIDE 40

Irradiance Change

ǫ(x) ≤

  • ∂E

∂x (x − x0) + ∂E ∂θ (θ − θ0)

  • position
  • rotation

≤ E0 4 π ||x − x0|| xavg +

  • 2 − 2

N(x) · N(x0)

  • position
  • rotation
slide-41
SLIDE 41

Irradiance Interpolation

w(x) = 1 ǫ(x) ≈ 1

||x−x0|| xavg +

  • 1 −

N(x) · N(x0) Ei(x) =

  • i

wi(x)E(xi)

  • i

wi(x)

slide-42
SLIDE 42

Irradiance Caching Algorithm

Find all irradiance samples with w(x) > q if (samples found) interpolate else compute new irradiance sample

slide-43
SLIDE 43

Box: Irradiance Caching

1000 sample rays, w>10

slide-44
SLIDE 44

Box: Irradiance Cache Positions

1000 sample rays, w>10

slide-45
SLIDE 45

Box: Irradiance Caching

1000 sample rays, w>20

slide-46
SLIDE 46

Box: Irradiance Cache Positions

1000 sample rays, w>20

slide-47
SLIDE 47

Box: Irradiance Caching

5000 sample rays, w>10

slide-48
SLIDE 48

Box: Irradiance Cache Positions

5000 sample rays, w>10

slide-49
SLIDE 49

Caustics

Pathtracing – 1000 paths/pixel

slide-50
SLIDE 50

A simple test scene

slide-51
SLIDE 51

Rendering

slide-52
SLIDE 52

Photon Tracing

slide-53
SLIDE 53

Photons

slide-54
SLIDE 54

Radiance Estimate

L(x, ω) =

fr(x, ω′, ω)L′(x, ω′) cos θ′ dω

slide-55
SLIDE 55

Radiance Estimate

L(x, ω) =

fr(x, ω′, ω)L′(x, ω′) cos θ′ dω =

fr(x, ω′, ω) dΦ2(x, ω′) dω cos θ′dA cos θ′dω

slide-56
SLIDE 56

Radiance Estimate

L(x, ω) =

fr(x, ω′, ω)L′(x, ω′) cos θ′ dω =

fr(x, ω′, ω) dΦ2(x, ω′) dω cos θ′dA cos θ′dω =

fr(x, ω′, ω)dΦ2(x, ω′) dA

slide-57
SLIDE 57

Radiance Estimate

L(x, ω) =

fr(x, ω′, ω)L′(x, ω′) cos θ′ dω =

fr(x, ω′, ω) dΦ2(x, ω′) dω cos θ′dA cos θ′dω =

fr(x, ω′, ω)dΦ2(x, ω′) dA ≈

n

  • p=1

fr(x, ω′

p,

ω)∆Φp(x, ω′

p)

πr2

slide-58
SLIDE 58

Radiance Estimate

L

slide-59
SLIDE 59

The photon map datastructure

The photons are stored in a left balanced kd-tree struct photon = { float position[3]; rgbe power; // power packed as 4 bytes char phi, theta; // incoming direction short flags; }

slide-60
SLIDE 60

Rendering: Caustics

slide-61
SLIDE 61

Caustic from a Glass Sphere

Photon Mapping: 10000 photons / 50 photons in radiance estimate

slide-62
SLIDE 62

Caustic from a Glass Sphere

Path Tracing: 1000 paths/pixel

slide-63
SLIDE 63

Sphereflake Caustic

slide-64
SLIDE 64

Reflection Inside A Metal Ring

50000 photons / 50 photons in radiance estimate

slide-65
SLIDE 65

Caustics On Glossy Surfaces

340000 photons / ≈ 100 photons in radiance estimate

slide-66
SLIDE 66

HDR environment illumination

Using lightprobe from www.debevec.org

slide-67
SLIDE 67

Cognac Glass

slide-68
SLIDE 68

Cube Caustic

slide-69
SLIDE 69

Global Illumination

100000 photons / 50 photons in radiance estimate

slide-70
SLIDE 70

Global Illumination

500000 photons / 500 photons in radiance estimate

slide-71
SLIDE 71

Fast estimate

200 photons / 50 photons in radiance estimate

slide-72
SLIDE 72

Indirect illumination

10000 photons / 500 photons in radiance estimate

slide-73
SLIDE 73

Global Illumination

slide-74
SLIDE 74

Global Illumination

global photon map caustics photon map

slide-75
SLIDE 75

Photon tracing

  • Photon emission
  • Photon scattering
  • Photon storing
slide-76
SLIDE 76

Photon emission

Given Φ Watt lightbulb. Emit N photons. Each photon has the power Φ

N Watt.

  • Photon power depends on the number of emitted

photons. Not on the number of photons in the photon map.

slide-77
SLIDE 77

What is a photon?

  • Flux (power) - not radiance!
  • Collection of physical photons

⋆ A fraction of the light source power ⋆ Several wavelengths combined into one entity

slide-78
SLIDE 78

Diffuse point light

Generate random direction Emit photon in that direction // Find random direction do { x = 2.0*random()-1.0; y = 2.0*random()-1.0; z = 2.0*random()-1.0; } while ( (x*x + y*y + z*z) > 1.0 );

slide-79
SLIDE 79

Example: Diffuse square light

  • Generate random position p on square
  • Generate diffuse direction d
  • Emit photon from p in direction d

// Generate diffuse direction u = random(); v = 2*π*random(); d = vector( cos(v)√u, sin(v)√u, √1 − u );

slide-80
SLIDE 80

Surface interactions

The photon is

  • Stored (at diffuse surfaces) and
  • Absorbed (A) or
  • Reflected (R) or
  • Transmitted (T)

A + R + T = 1.0

slide-81
SLIDE 81

Photon scattering

The simple way: Given incoming photon with power Φp Reflect photon with the power R ∗ Φp Transmit photon with the power T ∗ Φp

slide-82
SLIDE 82

Photon scattering

The simple way: Given incoming photon with power Φp Reflect photon with the power R ∗ Φp Transmit photon with the power T ∗ Φp

  • Risk: Too many low-powered photons - wasteful!
  • When do we stop (systematic bias)?
  • Photons with similar power is a good thing.
slide-83
SLIDE 83

Russian Roulette

  • Statistical technique
  • Known from Monte Carlo particle physics
  • Introduced to graphics by Arvo and Kirk in 1990
slide-84
SLIDE 84

Russian Roulette

Probability of termination: p

slide-85
SLIDE 85

Russian Roulette

Probability of termination: p E{X}

slide-86
SLIDE 86

Russian Roulette

Probability of termination: p E{X} = p · 0

slide-87
SLIDE 87

Russian Roulette

Probability of termination: p E{X} = p · 0 + (1 − p)

slide-88
SLIDE 88

Russian Roulette

Probability of termination: p E{X} = p · 0 + (1 − p) · E{X} 1 − p

slide-89
SLIDE 89

Russian Roulette

Probability of termination: p E{X} = p · 0 + (1 − p) · E{X} 1 − p = E{X}

slide-90
SLIDE 90

Russian Roulette

Probability of termination: p E{X} = p · 0 + (1 − p) · E{X} 1 − p = E{X} Terminate un-important photons and still get the correct result.

slide-91
SLIDE 91

Russian Roulette Example

Surface reflectance: R = 0.5 Incoming photon: Φp = 2 W r = random(); if ( r < 0.5 ) reflect photon with power 2 W else photon is absorbed

slide-92
SLIDE 92

Russian Roulette Intuition

Surface reflectance: R = 0.5 200 incoming photons with power: Φp = 2 Watt Reflect 100 photons with power 2 Watt instead of 200 photons with power 1 Watt.

slide-93
SLIDE 93

Russian Roulette

  • Very important!
  • Use to eliminate un-important photons
  • Gives photons with similar power :)
slide-94
SLIDE 94

Sampling a BRDF

fr(x, ωi, ωo) = w1fr,1(x, ωi, ωo) + w2fr,2(x, ωi, ωo)

slide-95
SLIDE 95

Sampling a BRDF

fr(x, ωi, ωo) = w1 · fr,d + w2 · fr,s r = random()·(w1 + w2); if ( r < w1 ) reflect diffuse photon else reflect specular

slide-96
SLIDE 96

Rendering

slide-97
SLIDE 97

Direct Illumination

slide-98
SLIDE 98

Specular Reflection

slide-99
SLIDE 99

Caustics

slide-100
SLIDE 100

Indirect Illumination

slide-101
SLIDE 101

Rendering Equation Solution

Lr(x, ω) =

  • Ωx

fr(x, ω′, ω)Li(x, ω′) cos θi dω′

i

=

  • Ωx

fr(x, ω′, ω)Li,l(x, ω′) cos θi dω′

i +

  • Ωx

fr,s(x, ω′, ω)(Li,c(x, ω′) + Li,d(x, ω′)) cos θi dω′

i +

  • Ωx

fr,d(x, ω′, ω)Li,c(x, ω′) cos θi dω′

i +

  • Ωx

fr,d(x, ω′, ω)Li,d(x, ω′) cos θi dω′

i .

slide-102
SLIDE 102

Features

  • Photon tracing is unbiased

⋆ Radiance estimate is biased but consistent ⋆ The reconstruction error is local

  • Illumination representation is decoupled from the

geometry

slide-103
SLIDE 103

Box

200000 global photons, 50000 caustic photons

slide-104
SLIDE 104

Box: Global Photons

200000 global photons

slide-105
SLIDE 105

Fractal Box

200000 global photons, 50000 caustic photons

slide-106
SLIDE 106

Cornell Box

slide-107
SLIDE 107

Indirect Illumination

slide-108
SLIDE 108

Little Matterhorn

slide-109
SLIDE 109

Mies house (swimmingpool)

slide-110
SLIDE 110

Mies house (3pm)

slide-111
SLIDE 111

Mies house (6pm)

slide-112
SLIDE 112

More Information

Realistic Image Synthesis Using Photon Mapping Realistic Image Synthesis Using Photon Mapping

Realistic Image Synthesis Using Photon Mapping

Realistic Image Synthesis Using Photon Mapping

Foreword by Pat Hanrahan

Realistic Image Synthesis Using Photon Mapping

Henrik Wann Jensen Jensen

Foreword by Pat Hanrahan

The creation of realistic three-dimensional images is central to

computer graphics. Photon mapping, an extension of ray tracing, makes it possible to efficiently simulate global illumination in complex scenes. Photo mapping can simulate caustics (focused light, such as shimmering waves at the bottom of a swimming pool), diffuse inter-reflections (e.g., the `bleeding' of colored light from a red wall onto a white floor, giving the floor a reddish tint), and participating media (e.g., clouds or smoke). This book is a practical guide to photon mapping; it provides both the theory and the practical insight necessary to implement photon mapping and simulate all types of direct and indirect illumination efficiently. A K PETERS LTD.

A K PETERS

Henrik Wann Jensen

http://graphics.stanford.edu/˜henrik henrik@graphics.stanford.edu