36
Lecture 8: Monte Carlo Rendering Chapters 4 and 5 in Advanced GI Fall 2004 Kavita Bala Computer Science Cornell University © Kavita Bala, Computer Science, Cornell University Homework HW 1out, due Oct 5 Assignments done separately – Might revisit this policy for later assignments

Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

  • Upload
    buingoc

  • View
    215

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

1

Lecture 8: Monte Carlo Rendering

Chapters 4 and 5 in Advanced GI

Fall 2004Kavita Bala

Computer ScienceCornell University

© Kavita Bala, Computer Science, Cornell University

Homework• HW 1out, due Oct 5

• Assignments done separately– Might revisit this policy for later assignments

Page 2: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

2

© Kavita Bala, Computer Science, Cornell University

Rendering Equation

∫Ω

Ψ⋅Ψ⋅Ψ←⋅Θ↔Ψ+Θ→=Θ→x

dnxLfxLxL xre ω),cos()()()()(

∫Ω

⋅⋅+=x

re fL cos

function to integrate over allincoming directions over thehemisphere around x

Value we want

© Kavita Bala, Computer Science, Cornell University

How to compute?

L(x→Θ) = ?

Check for Le(x→Θ)

Now add Lr(x→Θ) = L=?

∫Ω

Ψ⋅Ψ⋅Ψ←⋅Θ↔Ψx

dnxLf xr ω),cos()()(

Page 3: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

3

© Kavita Bala, Computer Science, Cornell University

How to compute?• Monte Carlo!

• Generate random directions on hemisphere Ωx, using pdf p(Ψ)

∫Ω

Ψ⋅Ψ⋅Ψ←⋅Θ↔Ψ=Θ→x

dnxLfxL xr ω),cos()()()(

∑= Ψ

Ψ⋅Ψ←⋅Θ↔Ψ=Θ→

N

i i

xiiir

pnxLf

NxL

1 )(),cos()()(1)(

© Kavita Bala, Computer Science, Cornell University

How to compute?

• evaluate L(x←Ψi)?

• Radiance is invariant along straight paths

• vp(x, Ψi) = first visible point

• L(x←Ψi) = L(vp(x, Ψi) → Ψi)

Page 4: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

4

© Kavita Bala, Computer Science, Cornell University

How to compute? Recursion ...

• Recursion ….

• Each additional bounce adds one more level of indirect light

• Handles ALL light transport

• “Stochastic Ray Tracing”

© Kavita Bala, Computer Science, Cornell University

PPyf )/(

Russian Roulette

Integral

Estimator

Variance

0 1

)(xf

P

∫∫∫ ===P

dyPPyfPdx

PxfdxxfI

0

1

0

1

0

)/()()(

>

≤=.0

,)(

Px

PxPxf

Ii

ii

roulette if

if

σσ >roulette

Page 5: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

5

© Kavita Bala, Computer Science, Cornell University

Russian Roulette

• Pick some ‘absorption probability’ α– probability 1-α that ray will bounce– estimated radiance becomes L/ (1-α)

• E.g. α = 0.9– only 1 chance in 10 that ray is reflected– estimated radiance of that ray is multiplied by 10– instead of shooting 10 rays, we shoot only 1, but

count the contribution of this one 10 times

© Kavita Bala, Computer Science, Cornell University

Algorithm so far ...• Shoot viewing ray through each pixel

• Shoot # indirect rays, sampled over hemisphere

• Terminate recursion using Russian Roulette

Page 6: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

6

© Kavita Bala, Computer Science, Cornell University

Pixel Anti-Aliasing

• Compute radiance only at center of pixel: jaggies

• Simple box filter:

• … evaluate using MC

∫=Pixel

dxxLL )(

© Kavita Bala, Computer Science, Cornell University

Stochastic Ray Tracing

• Parameters?– # starting rays per pixel– # random rays for each surface point

(branching factor)

• Path Tracing– Branching factor == 1

Page 7: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

7

© Kavita Bala, Computer Science, Cornell University

Path tracing

1 ray / pixel 10 rays / pixel 100 rays / pixel

• Pixel sampling + light source sampling folded into one method

© Kavita Bala, Computer Science, Cornell University

Comparison

1 centered viewing ray100 random shadow rays per

viewing ray

100 random viewing rays1 random shadow ray per

viewing ray

Page 8: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

8

© Kavita Bala, Computer Science, Cornell University

Algorithm so far ...• Shoot # viewing rays through each pixel

• Shoot # indirect rays, sampled over hemisphere– Path tracing shoots only 1 indirect ray

• Terminate recursion using Russian Roulette

© Kavita Bala, Computer Science, Cornell University

Algorithm

?=L ?=L ?0

==

r

e

LL

?0

==

r

e

LL ?=inL ?=inL ?=inL ?=inL

?0

==

r

e

LL

?0

==

r

e

LL

?=L ?=L?=inL ?=inL

?=L ?=L

?234.1

==

r

e

LL

?234.1

==

r

e

LL

Page 9: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

9

© Kavita Bala, Computer Science, Cornell University

Performance/Error

• Want better quality with smaller number of samples – Fewer samples/better performance– Stratified sampling– Quasi Monte Carlo: well-distributed samples

• Faster convergence– Importance sampling: next-event estimation

© Kavita Bala, Computer Science, Cornell University

0 1

)(xf

Stratified Sampling

• Samples could be arbitrarily close

• Split integral in subparts

• Estimator

• Variance:

∑=

=N

i i

istrat xp

xfN

I1 )(

)(1

secσσ ≤strat

∫∫ ++=NXX

dxxfdxxfI )()(1

K

Page 10: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

10

© Kavita Bala, Computer Science, Cornell University

Numerical example

© Kavita Bala, Computer Science, Cornell University

Stratified Sampling

9 shadow raysnot stratified

9 shadow raysstratified

Page 11: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

11

© Kavita Bala, Computer Science, Cornell University

Stratified Sampling

36 shadow raysnot stratified

36 shadow raysstratified

© Kavita Bala, Computer Science, Cornell University

Stratified Sampling

100 shadow raysnot stratified

100 shadow raysstratified

Page 12: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

12

© Kavita Bala, Computer Science, Cornell University

•• • •

• • ••

• • • •

• • • •

→ N2 samples

2 Dimensions

• Problem for higher dimensions

• Sample points can still be arbitrarily close to each other

© Kavita Bala, Computer Science, Cornell University

Higher Dimensions• Stratified grid sampling:

→ Nd samples

• N-rooks sampling:

→ N samples

•• • •

• • ••

• • • •

• • • •

••

Page 13: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

13

© Kavita Bala, Computer Science, Cornell University

N-Rooks Sampling - 9 rays

notstratified

stratified N-Rooks

© Kavita Bala, Computer Science, Cornell University

N-Rooks Sampling - 36 rays

notstratified

stratified N-Rooks

Page 14: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

14

© Kavita Bala, Computer Science, Cornell University

• How does it relate to regular sampling

Other types of Sampling

Random sampling Regular sampling

© Kavita Bala, Computer Science, Cornell University

Quasi Monte Carlo• Eliminates randomness to find well-

distributed samples• Samples are determinisitic but “appear”

random

Page 15: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

15

© Kavita Bala, Computer Science, Cornell University

Quasi-Monte Carlo (QMC)• Notions of variance, expected value don’t

apply

• Introduce the notion of discrepancy– Discrepancy mimics variance– E.g., subset of unit interval [0,x]

Of N samples, n are in subsetDiscrepancy: |x-n/N|

– Mainly: “it looks random”

© Kavita Bala, Computer Science, Cornell University

Quasi Monte Carlo

Page 16: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

16

© Kavita Bala, Computer Science, Cornell University

Example: Hammersley• Radical inverse φp(i) for primes p• Reflect digits (base p) about decimal point

φ2(i): 1110102 → 0.010111

• For N samples, a Hammersley point – (i/N, φ2(i))

• For more dimensions:– Xi =(i/N, φ2(i), φ3(i), φ5(i), φ7(i), φ11(i), ….)

© Kavita Bala, Computer Science, Cornell University

Halton• Radical inverse function

– Inverts bits around decimal point

• Sample: – Where b1, b2, b3 are primes

1)()(

)(

−−∑

∑=Φ

=

j

jjb

j

jj

biai

biai

),...)(),(),((321iiix bbbi ΦΦΦ=

Page 17: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

17

© Kavita Bala, Computer Science, Cornell University

Quasi Monte Carlo

• Converges as fast as stratified sampling– Does not require knowledge about how many

samples will be used

• Using QMC, directions evenly spaced no matter how many samples are used

• Samples properly stratified-> better than pure MC

© Kavita Bala, Computer Science, Cornell University

Performance/Error

• Want better quality with smaller number of samples – Fewer samples/better performance– Stratified sampling– Quasi Monte Carlo: well-distributed samples

• Faster convergence– Importance sampling: next-event estimation

Page 18: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

18

© Kavita Bala, Computer Science, Cornell University

Path Tracing

1 sample/pixel 16 samples/pixel 256 samples/pixel

Sample hemisphere

• Importance Sampling: compute direct illumination separately!

© Kavita Bala, Computer Science, Cornell University

Direct Illumination• Paths of length 1 only, between receiver

and light source

Page 19: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

19

© Kavita Bala, Computer Science, Cornell University

Direct Illumination Global Illumination

© Kavita Bala, Computer Science, Cornell University

Next Event Estimation

Radiance from light sources + radiance from other surfaces

∫Ω

Ψ⋅Ψ⋅Ψ←⋅Θ↔Ψ+Θ→=Θ→x

dnxLfxLxL xre ω),cos()()()()(

∫Ω

⋅⋅+=x

re fL cos

Page 20: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

20

© Kavita Bala, Computer Science, Cornell University

Next Event Estimation

indirectdirecte LLLxL ++=Θ→ )(

∫∫ΩΩ

⋅⋅+⋅⋅+=xx

rre ffL coscos

• So … sample direct and indirect with separate MC integration

© Kavita Bala, Computer Science, Cornell University

Algorithm

?=L ?=L?0

==

r

e

LL

?0

==

r

e

LL

??0

===

i

d

e

LLL

??0

===

i

d

e

LLL

?=L ?=L

?345.2

0

=≈=

i

d

e

LLL

?345.2

0

=≈=

i

d

e

LLL

Page 21: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

21

© Kavita Bala, Computer Science, Cornell University

Algorithm

© Kavita Bala, Computer Science, Cornell University

Algorithm

→a variant of path tracing

Page 22: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

22

© Kavita Bala, Computer Science, Cornell University

Comparison

Without N.E.E. With N.E.E.

16 samples/pixel

© Kavita Bala, Computer Science, Cornell University

Rays per pixel

1 sample/pixel

4 samples/pixel

16 samples/pixel

256 samples/pixel

Page 23: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

23

© Kavita Bala, Computer Science, Cornell University

How to sample direct illumination• Sampling a single light source

• Sampling for many lights

© Kavita Bala, Computer Science, Cornell University

Direct Illumination

∫ ⋅⋅Ψ→⋅Θ↔Ψ−=Θ→sourceA

yr dAyxGyLxfxL ),()(),()(

x

y

rxy

Vis(x,y)=?

Ψ

Θ

nx

ny

2

),(),cos(),cos(),(

xy

yx

ryxVisnn

yxGΨΘ

=

nxΨ

hemisphere integration area integration

−Ψ

Page 24: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

24

© Kavita Bala, Computer Science, Cornell University

Two forms of the RE• Hemisphere integration

• Area integration (over polygons from set A)

∫ ⋅⋅⋅

⋅Ψ−→⋅Θ↔Ψ+Θ→=Θ→A

yxy

yxre dAyxV

ryLfxLxL ),(

coscos)()()()( 2

θθ

∫Ω

Ψ⋅⋅Ψ←⋅Θ↔Ψ+Θ→=Θ→x

dxLfxLxL xre ωθcos)()()()(

© Kavita Bala, Computer Science, Cornell University

∫Ω

Ψ⋅⋅Ψ←⋅Θ↔Ψ=Θ→x

dxLfxL xrdirect ωθcos)()()(

Rendering Equation

dAy

Ψωd

Ψ

x

2

cos

xy

yy

rdA

ω =Ψ

),( Ψ= xvpy

)),(()( Ψ−→Ψ=Ψ← xvpLxL

Page 25: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

25

© Kavita Bala, Computer Science, Cornell University

Rendering Equation: visible surfaces

∫Ω

Ψ⋅⋅Ψ←⋅Θ↔Ψ=Θ→x

dxLfxL xrdirect ωθcos)()()(

=Θ→ )(xLdirect

),( Ψ= xvpy

Integration domain = surface points y on lights

Coordinate transform

∫lights all on y

)( Ψ−→⋅ yL)( Θ↔Ψrf yxy

yx dA

ryxV ⋅⋅ 2

coscos),(

θθ

© Kavita Bala, Computer Science, Cornell University

RE over light sources

∫ ⋅⋅Ψ−→⋅Θ↔Ψ−=Θ→sourceA

ysourcer dAyxGyLxfxL ),()(),()(

nx

ny

2

),(coscos),(

xy

yx

ryxVis

yxGθθ

=

area integration

y

Ψ

rxy

Vis(x,y)=?

−Ψ

Page 26: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

26

© Kavita Bala, Computer Science, Cornell University

Estimator for direct lighting• Pick a point on the light’s surface with pdf

• For N samples, direct light at point x is:

∑=

=N

i i

iyx

yxsourcer

yp

yxVisr

Lf

NxE i

i

1

2

)(

),(coscos

1)(

θθ

)(yp

© Kavita Bala, Computer Science, Cornell University

Generating direct paths• Pick surface points yi on light source• Evaluate direct illumination integral

x

∑=

=Θ→N

i i

ir

ypyxGLf

NxL

1 )(),((...)(...)1)(

Θ

y

rxy

θx

θy

Vis(x,y)=?

Page 27: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

27

© Kavita Bala, Computer Science, Cornell University

PDF for sampling light• Uniform

• Pick a point uniformly over light’s area– Can stratify samples

• Estimator:

sourceAreayp 1)( =

∑=

=N

ii

yx

yxsourcer

source yxVisr

LfN

AreaxEi

i

12 ),(coscos

)(θθ

© Kavita Bala, Computer Science, Cornell University

∑=

=N

ii

yx

yxsourcer

source yxVisr

LfN

AreaxEi

i

12 ),(coscos

)(θθ

More points ...

1 shadow ray 9 shadow rays

Page 28: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

28

© Kavita Bala, Computer Science, Cornell University

Even more points ...

36 shadow rays 100 shadow rays

∑=

=N

ii

yx

yxsourcer

source yxVisr

LfN

AreaxEi

i

12 ),(coscos

)(θθ

© Kavita Bala, Computer Science, Cornell University

Different pdfs• Uniform

• Solid angle sampling– Removes cosine and distance from integrand– Better when significant foreshortening

sourceAreayp 1)( =

∑=

=N

i i

iyx

yxsourcer

yp

yxVisr

Lf

NxE i

i

1

2

)(

),(coscos

1)(

θθ

Page 29: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

29

© Kavita Bala, Computer Science, Cornell University

Parameters• How to distribute paths within light source?

– Uniform– Solid angle– What about light distribution?

• How many paths (“shadow-rays”)?– Total?– Per light source? (~intensity, importance, …)

© Kavita Bala, Computer Science, Cornell University

Scenes with many lights• Many lights in scenes: M lights

• How to handle many lights?

• Formulation 1: M integrals, one per light– Same solution technique as earlier for each

light

∫∑ ⋅⋅Ψ−→⋅Θ↔Ψ−=Θ→= sourceA

ysourcer

M

idAyxGyLxfxL ),()(),()(

1

Page 30: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

30

© Kavita Bala, Computer Science, Cornell University

Lighting: point sources

lights

eye

x

© Kavita Bala, Computer Science, Cornell University

Scenes with many lights• Various choices:

– Shadow rays per light source– Distribution of shadow rays within a light

source

• Total # rays = M N– Where, M = #lights, N = #rays per source

Page 31: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

31

© Kavita Bala, Computer Science, Cornell University

Antialiasing: pixel

lights

eye

pixel90 rays

• Anti-aliasing: k M N

© Kavita Bala, Computer Science, Cornell University

Formulation over all lights• When M is large, each direct lighting

sample is very expensive

• We would like to importance sample the lights

• Instead of M integrals

• Formulation over 1 integration domain∫ ⋅⋅Ψ−→⋅Θ↔Ψ−=Θ→lightsallA

ysourcer dAyxGyLxfxL ),()(),()(

∫∑ ⋅⋅Ψ−→⋅Θ↔Ψ−=Θ→= sourceA

ysourcer

M

idAyxGyLxfxL ),()(),()(

1

Page 32: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

32

© Kavita Bala, Computer Science, Cornell University

Why?• Do not need a minimum of M rays/sample• Can use only one ray/sample

• Still need N samples, but 1 ray/sample

• Ray is distributed over the whole integration domain– Can importance sample the lights

© Kavita Bala, Computer Science, Cornell University

Anti-aliasing

lights

eye

pixel 10 rays 10 rays

• Can piggy-back on the anti-aliasing of pixel

Page 33: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

33

© Kavita Bala, Computer Science, Cornell University

How to sample the lights?• A discrete pdf pL(ki) picks the light ki

• A surface point is then picked with pdfp(yi|ki)

• Estimator with N samples:∑

=

=N

i iiiL

isourcer

kypkpyxGLf

NxE

1 )|()(),(1)(

© Kavita Bala, Computer Science, Cornell University

Strategies for picking light

– Uniform

– Area

– Power

MkpL

1)( =

∑=

k

kL P

Pkp )(

∑=

k

kL A

Akp )(

Page 34: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

34

© Kavita Bala, Computer Science, Cornell University

Example for 2 lights• Light 0 has power 1, Light 1 has power 2

• Using power for pdf: – pL(L0) = 1/3, pL(L1) = 2/3

• Overall pdf )(32)(

31)(

10ypypyp LL +=

0.33

L0 L1

© Kavita Bala, Computer Science, Cornell University

Example for 2 lights• Pick a random value:

• If

• Sample Light 0 and compute estimate e0

• Overall estimate is

31

0 <ξ

310e

Page 35: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

35

© Kavita Bala, Computer Science, Cornell University

Example for 2 lights• If

• Sample Light 1 and compute estimate e1

• Overall estimate is

131

0 <≤ ξ

321e

© Kavita Bala, Computer Science, Cornell University

How to sample light?• Once light is picked, can pick two random

numbers according to pL0(y), pL1(y)

• To decrease variance we should reuse

• But, already used information in to pick the light

21,ξξ

Page 36: Lecture 8: Monte Carlo Rendering - cs. · PDF fileLecture 8: Monte Carlo Rendering ... • Problem for higher dimensions ... N-Rooks Sampling - 9 rays not stratified stratified N-Rooks

36

© Kavita Bala, Computer Science, Cornell University

Example for 2 lights• Rescale

• Use to pick samples on light 1

0.33

L0 L1

5333.00 =ξ

(0.533-0.333)3/2 = .3

),( 10/ ξξ

)31(

23

00/ −= ξξ