monte carlo global illumination
DESCRIPTION
Monte Carlo Global Illumination. Brandon Lloyd COMP 238 December 16, 2002. Monte Carlo Method. Advantages Good for integrals of high dimension All you need is point samples Allows for arbitrary number of samples Disadvantages - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/1.jpg)
1
Monte Carlo Global Illumination
Brandon Lloyd
COMP 238December 16, 2002
![Page 2: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/2.jpg)
2
Monte Carlo Method
• Advantages– Good for integrals of high dimension– All you need is point samples– Allows for arbitrary number of samples
• Disadvantages– Susceptible to noise (caused by high frequencies in
the integrand)– Slow convergence where N is the number
of samples)( NO
![Page 3: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/3.jpg)
3
Monte Carlo Method
• The expected value of a function f according to a pdf p:
• Can be approximated with a discrete number of samples xi ~ p (converges as N)
dxxpxfxfE )()()]([
N
iixfN
xfE1
)(1)]([
![Page 4: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/4.jpg)
4
Monte Carlo Method
• … but we are interested in the integral of an arbitrary function f.
N
i i
i
xpxf
Nxf
1 )()(1)(
N
iii xf
Nxpxf
1
)(1)()(
![Page 5: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/5.jpg)
5
Importance Sampling
• We can use any distribution p that is non-zero over the domain
• The distribution affects variance • The more closely p matches f the less variance
you will have.• If p = f then you get the right answer with one
sample! But that requires we know f.
N
i i
i
xpxf
Nxf
1 )()(1)(
![Page 6: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/6.jpg)
6
Importance Sampling
• Directional formulation of the rendering equation:
• We don’t know Li . We can sample according to: f, cos , or f cos
iiiioiro dLxfxL cos)(),(),(
![Page 7: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/7.jpg)
7
Importance Sampling
• Point formulation of the rendering equation:
• A bit more complicated. Usually just generate points on the surfaces.
)(coscos),(),(),,(),( 2 xdAxx
xxVxxLxxxfxxLS
ir
![Page 8: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/8.jpg)
8
Generating Samples
• We can easily generate a uniform random variable U.
• Use the Inversion Method to transform U to X ~ p.
– Create the CDF of p
– Use the inverse of P to transform U.
x
dsspxP )()(
)(1 UPX
![Page 9: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/9.jpg)
9
Example: Diffuse BRDF
• Choose
iiiio dLxL cos)(),(
2
0 0
sincos)(2
iiiiii ddL
sincos),( p
![Page 10: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/10.jpg)
10
Example: Diffuse BRDF
• p is separable so we treat each dimension independently
• Invert by solving for u0 = P and u1 = P
221
cossincos
0
0
2
dP
dP
)2),(arccos(),( 21 uu
![Page 11: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/11.jpg)
11
Example: Diffuse BRDF
• Final Estimator
• The Global Illumination Compendium [Dutre 2001] contains transformations for a number of useful pdfs that arise in global illumination problems
)(1),( iio LN
xL
![Page 12: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/12.jpg)
12
Tranforming the Distribution
• The distribution is created in a canonical space but we need to have it about the surface normal.
ZN
![Page 13: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/13.jpg)
13
Tranforming the Distribution
• Obvious method. Create a coordinate frame by picking arbitrary S. T = ||NxS|| S=||TxN||
• Can be done more cheaply [Hughes99]• If the distribution is isotropic then reflect about
the half-way vectorZ
H
N
![Page 14: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/14.jpg)
14
Results
Test Scene
![Page 15: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/15.jpg)
15
BRDF sampling Area sampling
Path tracing (combined sampling)
Multiple Importancesampling
![Page 16: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/16.jpg)
16
Path tracing
Multiple ImportanceSampling
Multiple ImportanceSampling
Bias!
![Page 17: Monte Carlo Global Illumination](https://reader033.vdocuments.mx/reader033/viewer/2022042901/56813b55550346895da44548/html5/thumbnails/17.jpg)
17
References
[Hughes99] John F. Hughes and Tomas Möller, “Building an Orthonormal Basis from a Unit Vector'' Journal of Graphics Tools, vol. 4, no. 4, pp. 33-35, 1999.
[Dutre01] Phillip Dutre, Global Illumination Compendium, http://www.graphics.cornell.edu/~phil/GI/, 2001