ΰΆ± Rendering: Monte Carlo Integration I Bernhard Kerbl Research Division of Computer Graphics Institute of Visual Computing & Human-Centered Technology TU Wien, Austria With slides based on material by Jaakko Lehtinen, used with permission
Todayβs Goal Integrating the cosine-weighted radiance π π (π¦, π) at a point π¦ Integral of the light function over the hemisphere, w.r.t. direction/solid angle π This is easier said than done! How do we integrate over the hemisphere? π π (π¦, π) depends on lights, geometryβ¦ how can we integrate that? Rendering β Monte Carlo Integration I 2
Todayβs Goal The solution involves methods from statistics, probability and calculus that are combined to achieve Monte Carlo Integration This is a lot to take in, some of the concepts are complex We choose to explore them in an illustrative way because grasping the underlying ideas makes their application much easier We will try to present the bare necessities you need to write a rendering routine two versions: a formal and an intuitive one Rendering β Monte Carlo Integration I 3
Fundamentals Recap Calculus Derivatives Integrals Probability and Statistics Discrete/Continuous Random Variables Uniform/Non-Uniform Distributions Probability Density Function Expected Value and Variance Rendering β Monte Carlo Integration I 4
Derivatives Derivative πβ²(π¦) of π(π¦) gives the rate of change of π(π¦) at point π¦ Answers the question: how does π§ = π(π¦) change within an π π¦+ππ¦ βπ(π¦) = ππ§ infinitesimally small range ππ¦ around π¦ π¦+ππ¦βπ¦ ππ¦ Closed- form solutions donβt always exist (discontinuous functions) Functions of multiple variables can be derived w.r.t. any of them, yielding a partial derivative (indicated by e.g. ππ¦ instead of ππ¦ ) Rendering β Monte Carlo Integration I 5
Indefinite Integral Basic notation: πΊ π¦ = Χ¬ π π¦ ππ¦ πΊ π¦ is any function that fulfills πΊ π¦ β² = π π¦ , thus it is generally called the βanti - derivativeβ of π π¦ By this definition, solutions can include arbitrary constants π , e.g.: 2 3 π¦ 2 π¦ ππ¦ = + π Χ¬ 3 π¦ 2 Χ¬ π¦ ππ¦ = 2 + π Χ¬ cos π¦ ππ¦ = sin π¦ + π Rendering β Monte Carlo Integration I 6
Definite Integral: An interpretation π π π¦ ππ¦ , with Basic notation: Χ¬ π the variable of integration π¦ the integration interval [π, π] for π¦ the function π π¦ to integrate ( integrand ) the differential ππ¦ for π¦ Informally: βThe area under the curveβ [1] The differential is an βinfinitesimal rangeβ, making π π¦ β ππ¦ an infinitesimal area. The integral is the sum of these areas in [π, π] Rendering β Monte Carlo Integration I 7
Definite Integral: An interpretation π π π¦ ππ¦ , with Basic notation: Χ¬ π the variable of integration π¦ Ξπ¦ the integration interval [π, π] for π¦ the function π π¦ to integrate ( integrand ) the differential ππ¦ for π¦ π(π¦) Informally: βThe area under the curveβ [1] The differential is an βinfinitesimal rangeβ, making π π¦ β ππ¦ an infinitesimal area. The integral is the sum of these areas in [π, π] Rendering β Monte Carlo Integration I 8
Definite Integral: An interpretation π π π¦ ππ¦ , with Basic notation: Χ¬ π the variable of integration π¦ Ξπ¦ the integration interval [π, π] for π¦ the function π π¦ to integrate ( integrand ) the differential ππ¦ for π¦ π(π¦) Informally: βThe area under the curveβ [1] The differential is an βinfinitesimal rangeβ, making π π¦ β ππ¦ an infinitesimal area. The integral is the sum of these areas in [π, π] Rendering β Monte Carlo Integration I 9
Definite Integral: An interpretation π π π¦ ππ¦ , with Basic notation: Χ¬ π the variable of integration π¦ Ξπ¦ the integration interval [π, π] for π¦ the function π π¦ to integrate ( integrand ) the differential ππ¦ for π¦ π(π¦) Informally: βThe area under the curveβ [1] The differential is an βinfinitesimal rangeβ, making π π¦ β ππ¦ an infinitesimal area. The integral is the sum of these areas in [π, π] Rendering β Monte Carlo Integration I 10
Definite Integral: An interpretation π π π¦ ππ¦ , with Basic notation: Χ¬ π the variable of integration π¦ Ξπ¦ = ππ¦ the integration interval [π, π] for π¦ the function π π¦ to integrate ( integrand ) the differential ππ¦ for π¦ π(π¦) Informally: βThe area under the curveβ [1] The differential is an βinfinitesimal rangeβ, making π π¦ β ππ¦ an infinitesimal area. The integral is the sum of these areas in [π, π] Rendering β Monte Carlo Integration I 11
Solving Definite Integrals With a solution for the indefinite integral πΊ π¦ = Χ¬ π π¦ ππ¦ , π π π¦ ππ¦ = πΊ π β πΊ(π) we can solve Χ¬ π Example: Unit circle: π¦ 2 + π§ 2 = 1 , area is π 1 1 β π¦ 2 π π¦ = π§ = Χ¬ π π¦ ππ¦ = 1 2 ( 1 β π¦ 2 β π¦ + sin β1 π¦) π§ 1 π π¦ ππ¦ = πΊ 1 β πΊ 0 = π Χ¬ 0 4 π¦ 0 1 Rendering β Monte Carlo Integration I 12
Solving Definite Integrals With a solution for the indefinite integral πΊ π¦ = Χ¬ π π¦ ππ¦ , π π π¦ ππ¦ = πΊ π β πΊ(π) we can solve Χ¬ π 1 Example: π π§ Unit circle: π¦ 2 + π§ 2 = 1 , area is π π 1 β π¦ 2 π π¦ = π§ = 0 π¦ 1 Χ¬ π π¦ ππ¦ = 1 2 ( 1 β π¦ 2 β π¦ + sin β1 π¦) 1 π π¦ ππ¦ = πΊ 1 β πΊ 0 = π Χ¬ 0 4 Rendering β Monte Carlo Integration I 13
Remarks on Definite Integrals To generalize to π - D, we will talk about βvolumeβ rather than area πΈ for integral over entire domain πΈ We use subscript-only symbol Χ¬ Integrating 1 over range [π, π] gives the length/volume of the range Integrating 1 over an π -D domain gives the volume of the domain A domain πΈ with X β [0, 2] , π β [2, 5] in and Z β [1, 1.5] , we have: 2 Χ¬ 5 Χ¬ 1.5 1 ππ¦ ππ§ ππ¨ = 2 Γ 3 Γ 0.5 = 3 πππ πΈ = Χ¬ πΈ 1 ππΈ = Χ¬ 0 2 1 Rendering β Monte Carlo Integration I 14
Random Variables We indicate random variables with capital letters π, π, β¦ and some Greek symbols for special random variables Random variables are drawn from some domain of possible results We define an outcome, or βeventβ for draws from random variables. π π marks an observed outcome of a given random variable π Random variables can be discrete or continuous. Functions of random variables can themselves be seen as random variables Rendering β Monte Carlo Integration I 15
Uniform and Non-Uniform Distributions The occurrence of values drawn from a random variable usually follows a given probability distribution If a random variable has a uniform distribution, all possible outcomes are equally likely to occur (e.g., a fair die or fair coin) For non-uniform distributions, the probability of certain values is significantly higher than others (e.g., population body height) Rendering β Monte Carlo Integration I 16
Discrete Random Variables In daily life, we are mostly confronted with discrete random results A coin flip Toss of a die Cards in a deck Each possible outcome of a random variable is associated with a specific probability π . Probabilities must sum up to 1 (100%) 1 E.g., a fair die: π β 1,2,3,4,5,6 and π 1 = π 2 = β― = π 6 = 6 Rendering β Monte Carlo Integration I 17
Continuous Random Variables A continuous random variable π with a given range [π, π) can assume any value π π that fulfills π β€ π π < π Working with continuous variables generalizes the methodology for many complex evaluations that depend on probability theory There are infinitely many possible outcomes and, consequently, the observation of any specific event has with vanishing probability How can we find the probabilities for continuous variables? [2] Rendering β Monte Carlo Integration I 18
Cumulative Distribution Function (CDF) For continuous variables, we cannot assign probabilities to values 0 1 ? If π can take on any value with equal probability, what is the probability of π = 0.5 ? The cumulative distribution function (CDF) lets us compute the probability of a variable taking on a value in a specified range [2] We use notation π π π¦ for the CDF of π βs distribution, which yields the probability of π taking on any value β€ π¦ Rendering β Monte Carlo Integration I 19
Probability for a Range with CDF π π π β π π π = ππ π β€ π π β€ π Read as: π’βπ ππ ππππππππ’π§ ππ π π’πππππ ππ πππ§ π€πππ£π ππ ππ 0 π’π π, ππππ£π‘ π’βπ ππ ππππππππ’π§ ππ π π’πππππ ππ πππ§ π€πππ£π ππ ππ 0 π’π π 1 Example: uniform variable ΞΎ generates values in range [0, 1): π π π¦ = π¦ π§ π(π¦) π π 0.75 β P π 0. 5 = 0.25 π¦ 0 1 Rendering β Monte Carlo Integration I 20
Recommend
More recommend