Monte Carlo Integration

Similar documents
CS 563 Advanced Topics in Computer Graphics Monte Carlo Integration: Basic Concepts. by Emmanuel Agu

Monte Carlo 1: Integration

Monte Carlo 1: Integration

Complex Filtering and Integration via Sampling

Monte Carlo Rendering

Motivation. Motivation. Monte Carlo. Example: Soft Shadows. Outline. Monte Carlo Algorithms. Advanced Computer Graphics (Fall 2009)

Discussion. History and Outline. Smoothness of Indirect Lighting. Irradiance Caching. Irradiance Calculation. Advanced Computer Graphics (Fall 2009)

Discussion. History and Outline. Smoothness of Indirect Lighting. Irradiance Calculation. Irradiance Caching. Advanced Computer Graphics (Fall 2009)

Biostatistics 615/815

Surface Integrators. Digital Image Synthesis Yung-Yu Chuang 12/20/2007

Diffuse and specular interreflections with classical, deterministic ray tracing

PBRT core. Announcements. pbrt. pbrt plug-ins

Computer graphics III Light reflection, BRDF. Jaroslav Křivánek, MFF UK

Lecture 5: Probability Distributions. Random Variables

CS 534: Computer Vision Model Fitting

An Accurate Evaluation of Integrals in Convex and Non convex Polygonal Domain by Twelve Node Quadrilateral Finite Element Method

Topic 13: Radiometry. The Basic Light Transport Path

Form-factors Josef Pelikán CGG MFF UK Praha.

AVO Modeling of Monochromatic Spherical Waves: Comparison to Band-Limited Waves

Plane Sampling for Light Paths from the Environment Map

Color in OpenGL Polygonal Shading Light Source in OpenGL Material Properties Normal Vectors Phong model

Accounting for the Use of Different Length Scale Factors in x, y and z Directions

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Global Illumination. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/26/07 1

Random Variables and Probability Distributions

Wishing you all a Total Quality New Year!

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

Some Advanced SPC Tools 1. Cumulative Sum Control (Cusum) Chart For the data shown in Table 9-1, the x chart can be generated.

Support Vector Machines

Computer Sciences Department

Scan Conversion & Shading

Solitary and Traveling Wave Solutions to a Model. of Long Range Diffusion Involving Flux with. Stability Analysis

Fitting & Matching. Lecture 4 Prof. Bregler. Slides from: S. Lazebnik, S. Seitz, M. Pollefeys, A. Effros.

Machine Learning: Algorithms and Applications

Scan Conversion & Shading

Hermite Splines in Lie Groups as Products of Geodesics

Range images. Range image registration. Examples of sampling patterns. Range images and range surfaces

(1) The control processes are too complex to analyze by conventional quantitative techniques.

Global Illumination: Radiosity

S1 Note. Basis functions.

C2 Training: June 8 9, Combining effect sizes across studies. Create a set of independent effect sizes. Introduction to meta-analysis

Parallelism for Nested Loops with Non-uniform and Flow Dependences

Image Representation & Visualization Basic Imaging Algorithms Shape Representation and Analysis. outline

Subspace clustering. Clustering. Fundamental to all clustering techniques is the choice of distance measure between data points;

LECTURE : MANIFOLD LEARNING

Radial Basis Functions

APPLICATION OF PREDICTION-BASED PARTICLE FILTERS FOR TELEOPERATIONS OVER THE INTERNET

Learning the Kernel Parameters in Kernel Minimum Distance Classifier

Programming in Fortran 90 : 2017/2018

Fast, Arbitrary BRDF Shading for Low-Frequency Lighting Using Spherical Harmonics

Global Illumination and Radiosity

Determining the Optimal Bandwidth Based on Multi-criterion Fusion

y and the total sum of

Physics 132 4/24/17. April 24, 2017 Physics 132 Prof. E. F. Redish. Outline

Unsupervised Learning

APPLICATION OF PREDICTION-BASED PARTICLE FILTERS FOR TELEOPERATIONS OVER THE INTERNET

Interactive Rendering of Translucent Objects

Reflection models. Rendering equation. Taxonomy 2. Taxonomy 1. Digital Image Synthesis Yung-Yu Chuang 11/01/2005

Unsupervised Learning and Clustering

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

cos(a, b) = at b a b. To get a distance measure, subtract the cosine similarity from one. dist(a, b) =1 cos(a, b)

Polyhedral Compilation Foundations

A MOVING MESH APPROACH FOR SIMULATION BUDGET ALLOCATION ON CONTINUOUS DOMAINS

2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

Lecture #15 Lecture Notes

Outline. Type of Machine Learning. Examples of Application. Unsupervised Learning

Global Illumination and Radiosity

Technical report, November 2012 (Revision 2, July 2013) Implementing Vertex Connection and Merging

NAG Fortran Library Chapter Introduction. G10 Smoothing in Statistics

Smoothing Spline ANOVA for variable screening

FEATURE EXTRACTION. Dr. K.Vijayarekha. Associate Dean School of Electrical and Electronics Engineering SASTRA University, Thanjavur

Surface Mapping One. CS7GV3 Real-time Rendering

Problem Set 3 Solutions

Kiran Joy, International Journal of Advanced Engineering Technology E-ISSN

A New Approach For the Ranking of Fuzzy Sets With Different Heights

All-Pairs Shortest Paths. Approximate All-Pairs shortest paths Approximate distance oracles Spanners and Emulators. Uri Zwick Tel Aviv University

Mathematics 256 a course in differential equations for engineering students

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS

AP PHYSICS B 2008 SCORING GUIDELINES

Lighting. Dr. Scott Schaefer

X- Chart Using ANOM Approach

Introduction to Radiosity

Performance Evaluation of Information Retrieval Systems

A fair buffer allocation scheme

Lecture 5: Multilayer Perceptrons

Support Vector Machines

Modeling, Manipulating, and Visualizing Continuous Volumetric Data: A Novel Spline-based Approach

Robust Curvature Estimation and Geometry Analysis of 3D point Cloud Surfaces

Feature Reduction and Selection

Classifier Selection Based on Data Complexity Measures *

Simulation Based Analysis of FAST TCP using OMNET++

Computer Animation and Visualisation. Lecture 4. Rigging / Skinning

Machine Learning. Support Vector Machines. (contains material adapted from talks by Constantin F. Aliferis & Ioannis Tsamardinos, and Martin Law)

An Optimal Algorithm for Prufer Codes *

Real-Time Guarantees. Traffic Characteristics. Flow Control

Type-2 Fuzzy Non-uniform Rational B-spline Model with Type-2 Fuzzy Data

EECS 730 Introduction to Bioinformatics Sequence Alignment. Luke Huan Electrical Engineering and Computer Science

GSLM Operations Research II Fall 13/14

Outline. Self-Organizing Maps (SOM) US Hebbian Learning, Cntd. The learning rule is Hebbian like:

PHYS 219 Spring semester Lecture 20: Reflection of Electromagnetic Radiation: Mirrors and Images Formed by Mirrors

Transcription:

Introducton Monte Carlo Integraton Dgtal Image Synthess Yung-Yu Chuang 11/9/005 The ntegral equatons generally don t have analytc solutons, so we must turn to numercal methods. L ( o p,ωo) = L e ( p,ωo) + s f (p,ωo,ω ) L (p,ω ) cosθ d Standard methods lke Trapezodal ntegraton or Gaussan quadrature are not effectve for hgh-dmensonal and dscontnuous ntegrals. ω wth sldes by Pat Hanrahan and Torsten Moller Smple ntegraton Trapezodal rule

Randomzed algorthms Las Vegas v.s. Monte Carlo Las Vegas: gves the rght answer by usng randomness. Monte Carlo: gves the rght answer on the average. Results depend on random numbers used, but statstcally lkely to be close to the rght answer. Monte Carlo ntegraton Monte Carlo ntegraton: uses samplng to estmate the values of ntegrals. It only requres to be able to evaluate the ntegrand at arbtrary ponts, makng t easy to mplement and applcable to many problems. If n samples are used, ts converges at the rate of O(n -1/ ). That s, to cut the error n half, t s necessary to evaluate four tmes as many samples. Images by Monte Carlo methods are often nosy. Monte Carlo methods Basc concepts X s a random varable Applyng a functon to a random varable gves another random varable, Y=f(X). CDF (cumulatve dstrbuton functon) P( x) Pr{ X x} PDF (probablty densty functon): nonnegatve, sum to 1 dp( x) p( x) dx canoncal unform random varable ξ (provded by standard lbrary and easy to transform to other dstrbutons)

Dscrete probablty dstrbutons Contnuous probablty dstrbutons Expected values Average value of a functon f(x) over some dstrbuton of values p(x) over ts doman D p [ f ( x) ] E f ( x) p( x) dx = D Example: cos functon over [0, π], p s unform E p = π 1 0 π [ cos( x) ] cos x dx = 0 Varance Expected devaton from the expected value Fundamental concept of quantfyng the error n Monte Carlo methods [( f ( x) E[ f ( )]) ] V[ f ( x)] = E x

Propertes [ af ( x) ] ae[ f ( x) ] E = E f ( X ) = E ) [ af ( x) ] a V [ f ( x) ] V = V [ f ( X ] [ f x) ] = E ( f ( x) ) [ ] E[ f ( )] ( x Monte Carlo estmator Assume that we want to evaluate the ntegral of f(x) over [a,b] Gven a unform random varable X over [a,b], Monte Carlo estmator says that the expected value E[F N ] of the estmator F N equals the ntegral N b a F = f ( X ) N N = 1 General Monte Carlo estmator Gven a random varable X drawn from an arbtrary PDF p(x), then the estmator s F N = 1 N N = 1 p( X ) f ( X ) Choosng samples How to sample an arbtrary dstrbuton from a varable of unform dstrbuton? Inverson Rejecton Transform Although the converge rate of MC estmator s O(N 1/ ), slower than other ntegral methods, ts converge rate s ndependent of the dmenson, makng t the only practcal method for hgh dmensonal ntegral

Inverson method Inverson method Compute CDF P(x) Compute P -1 (x) Obtan ξ Compute X =P -1 (ξ) Example: exponental dstrbuton Example: power functon, for example, Blnn s Fresnel term Compute CDF P(x) Compute P -1 (x) Obtan ξ Compute X =P -1 (ξ)

Samplng a crcle Samplng a crcle Rejecton method Rejecton method Sometmes, we can t ntegrate nto CDF or nvert CDF Rejecton method s a fart-throwng method wthout performng the above steps 1. Fnd q(x) so that p(x)<cq(x). Dart throwng a. Choose a par (X, ξ), where X s sampled from q(x) b. If (ξ<p(x)/cq(x)) return X Essentally, we pck a pont (X, ξcq(x)). If t les beneath p(x) then we are fne.

Example: samplng a unt sphere vod RejectonSampleDsk(float *x, float *y) { float sx, sy; do { sx = 1.f -.f * RandomFloat(); sy = 1.f -.f * RandomFloat(); } whle (sx*sx + sy*sy > 1.f) *x = sx; *y = sy; } π/4~78.5% good samples, gets worse n hgher dmensons, for example, for sphere, π/6~5.3% Transformng between dstrbutons Transform a random varable X from dstrbuton p x (x) to a random varable Y wth dstrbuton p y (x) Y=y(X), y s one-to-one,.e. monotonc Hence, Py ( y) = Pr{ Y y( x)} = Pr{ X x} = Px ( x) PDF: dpy ( y) dpx ( x) = dx dx p y dy ( y) = dx dpy ( y) dy dy dx p x (x) p y ( y) = dy dx 1 p ( x) x Example p x ( x) = x Y = sn X Transform Gven X wth p x (x) and p y (y), try to use X to generate Y. p y ( y) = (cos x) 1 p ( x) = x x cos x = sn 1 1 y y

Multple dmensons Multple dmensons Multdmensonal samplng Samplng a hemsphere

Samplng a hemsphere Samplng a hemsphere Samplng a dsk Samplng a dsk

Shrley s mappng Samplng a trangle Samplng a trangle Multple mportance samplng

Multple mportance samplng Multple mportance samplng Monte Carlo for renderng equaton L ( o p,ωo) = L e ( p,ωo) + s f (p,ωo,ω ) L (p,ω ) cosθ d Importance samplng: sample ω accordng to BxDF f and L (especally for lght sources) If we don t need anythng about f and L, use cosne-weghted samplng of hemsphere to fnd a sampled ω ω Cosne weghted hemsphere p( ω) cosθ 1 = p( ω) dω H = π π 0 0 1 c cosθ snθdθdφ 1 = cπ π 0 cosθ snθdθ 1 c = π 1 p( θ, φ) = cosθ snθ π dω = snθdθdφ

Cosne weghted hemsphere 1 p( θ, φ) = cosθ snθ π π 1 p( θ ) = cosθ snθdφ = cosθ snθ = sn θ 0 π p( θ, φ) 1 p( φ θ ) = = p ( θ ) π 1 1 1 1 P( θ ) = cos θ + = ξ1 θ = cos (1 ξ1) φ P( φ θ ) = = ξ φ = πξ π Cosne weghted hemsphere Malley s method: unformly generates ponts on the unt dsk and then generates drectons by projectng them up to the hemsphere above t. Vector CosneSampleHemsphere(float u1,float u){ Vector ret; ConcentrcSampleDsk(u1, u, &ret.x, &ret.y); ret.z = sqrtf(max(0.f,1.f - ret.x*ret.x - ret.y*ret.y)); return ret; } Cosne weghted hemsphere Why Malley s method works Unt dsk samplng ( r, φ) Map to hemsphere here r, ) p y ( y) = dy dx 1 p ( x) x r p = π ( φ (snθ, φ) Y = ( r, φ ), X = ( θ, φ) Samplng reflecton functons Spectrum BxDF::Sample_f(const Vector &wo, Vector *w, float u1, float u, float *pdf){ *w = CosneSampleHemsphere(u1, u); f (wo.z < 0.) w->z *= -1.f; *pdf = Pdf(wo, *w); return f(wo, *w); } For those who modfed Sample_f, Pdf must be changed accordngly float BxDF::Pdf(Vector &wo, Vector &w) { return SameHemsphere(wo, w)? fabsf(w.z) * INV_PI : 0.f; } Ths functon s useful for multple mportance samplng.

Samplng mcrofacet model Too complcated to sample accordng to f, sample D nstead. Samplng Blnn mcrofacet model Blnn dstrbuton: e + e D ( ωh) = ( ωh n) π Generate ω h accordng to the above functon cos + θ = e 1 h ξ1 φ h = πξ Convert ω h to ω ω = ω + ( ω ω ) ω o o h h ω o ω h ω Samplng Blnn mcrofacet model Convert half-angle Pdf to ncomng-angle Pdf, that s, change from a densty n term of ω h to one n terms of ω Samplng ansotropc mcrofacet model Ansotropc model (after Ashkhmn and Shrley) for the frst quadrant of the unt hemsphere D( ω ) = h ( e x + 1)( e y + 1)( ω n) h e cos φ sn x + e y φ

Samplng BSDF (mxture of BxDFs) Sample from the densty that s the sum of ndvdual denstes Three unform random numbers are used, the frst one determnes whch BxDF to be sampled and then sample that BxDF usng the other two random numbers Samplng lght sources Drect llumnaton from lght sources makes an mportant contrbuton, so t s crucal to be able to Sp: samples drectons from a pont p to the lght Sr: Generates random rays from the lght source (for bdrectonal lght transport algorthms such as bdrectonal path tracng and photon mappng) Pont lghts Sp: delta dstrbuton, treat smlar to specular BxDF Sr: samplng of a unform sphere Spotlghts Sp: the same as a pont lght Sr: samplng of a cone (do not consder the falloff)

Drectonal lghts Sp: lke pont lghts Sr: create a vrtual dsk of the same radus as scene s boundng sphere and then sample the dsk unformly. Area lghts Defned by shape Add shape samplng functons for Shape Sp: uses a densty wth respect to sold angle from the pont p Pont Sample(Pont &P, float u1, float u, Normal *Ns) Sr: generates ponts on the shape accordng to a densty wth respect to surface area Pont Sample(float u1, float u, Normal *Ns) Infnte area lghts Sp: normal gven: cosne weghted samplng Otherwse: unform sphercal samplng Does not take drectonal radance dstrbuton nto account Sr: Unformly sample two ponts p 1 and p on the sphere Use p1 as the orgn and p -p 1 as the drecton It can be shown that p -p 1 s unformly dstrbuted (L et. al. 003)