Download presentation
Presentation is loading. Please wait.
Published byBrenda Wheeler Modified over 5 years ago
1
Monte Carlo I Previous lecture Analytical illumination formula
This lecture Numerical evaluation of illumination Review random variables and probability Monte Carlo integration Sampling from distributions Sampling from shapes Variance and efficiency
2
Lighting and Soft Shadows
Challenges Visibility and blockers Varying light distribution Complex source geometry Source: Agrawala. Ramamoorthi, Heirich, Moll, 2000
3
Penumbras and Umbras Should show the view of the light source from the floor at various points Redraw this figure. Showed how Lambert’s formulas could be extended to include blockers Mentioned that Lambert considered regions with different curves as boundaries, including pieces of a sphere Talked about the shape of the figure on the plane as being a convolution of the two shapes The shape is a 4D hypercube-like structure Boundaries introduce discontinuities in the function Meshing involves breaking surfaces into mesh elements according to these boundaries
4
Monte Carlo Lighting 1 eye ray per pixel 1 shadow ray per eye ray
The 4 eye ray part of this is confusing. Just do 1 eye ray. 1 eye ray per pixel 1 shadow ray per eye ray Fixed Random
5
Monte Carlo Algorithms
Advantages Easy to implement Easy to think about (but be careful of statistical bias) Robust when used with complex integrands and domains (shapes, lights, …) Efficient for high dimensional integrals Efficient solution method for a few selected points Disadvantages Noisy Slow (many samples needed for convergence)
6
Random Variables is chosen by some random process
probability distribution (density) function
7
Discrete Probability Distributions
Discrete events Xi with probability pi Cumulative PDF (distribution) Construction of samples To randomly select an event, Select Xi if Uniform random variable
8
Continuous Probability Distributions
Uniform PDF CDF p(x) dx is the probability that x lies between x and x + dx. P(x) : if we were to choose a random variable X, then Pr(X < x) should be P(x) More generally, Pr(alpha ) …
9
Sampling Continuous Distributions
Cumulative probability distribution function Construction of samples Solve for X=P-1(U) Must know: 1. The integral of p(x) 2. The inverse function P-1(x)
10
Example: Power Function
Assume Trick Write out the description of the trick. It is hard to explain this method clearly.
11
Sampling a Circle Went through the following argument.
Suppose we have a die with 6 faces. We justify that all faces are equally likely by saying that if we relabeled the faces, the probabilities would be unchanged. The same argument applies to areas. If we translate an area, then the probability of that area should be unchanged. Translation basic leads to linearity. We should write something like A = \int p(A) dA = …
12
Sampling a Circle WRONG Equi-Areal RIGHT = Equi-Areal
13
Rejection Methods Algorithm Pick U1 and U2 Accept U1 if U2 < f(U1)
Wasteful? This is written as if we are computing area. In the current flow, this should be converted to sampling according to a pdf. Efficiency = Area / Area of rectangle
14
Sampling a Circle: Rejection
do { X=1-2*U1 Y=1-2*U2 while( X2+ Y2 >1 ) May be used to pick random 2D directions Circle techniques may also be applied to the sphere
15
Monte Carlo Integration
Definite integral Expectation of f Random variables Estimator
16
Over Arbitrary Domains
17
Non-Uniform Distributions
18
Unbiased Estimator Properties Assume uniform probability
Skipped this derivation. Part that needs to be explained more clearly is E[Y_i] = I(f) Assume uniform probability distribution for now
19
Direct Lighting – Directional Sampling
Ray intersection Sample uniformly by Show an example of sampling according to solid angle immediately following this slide.
20
Direct Lighting – Area Sampling
Ray direction Sample uniformly by
21
Examples 4 eye rays per pixel 1 shadow ray per eye ray Fixed Random
The 4 eye ray part of this is confusing. Just do 1 eye ray. 4 eye rays per pixel 1 shadow ray per eye ray Fixed Random
22
Examples 4 eye rays per pixel 16 shadow rays per eye ray Uniform grid
Stratified random
23
Examples 4 eye rays per pixel 64 shadow rays per eye ray Uniform grid
Stratified random
24
Examples 4 eye rays per pixel 100 shadow rays per eye ray Uniform grid
Stratified random
25
Examples 4 eye rays per pixel 16 shadow rays per eye ray
What is the cost of these two alternatives. Assume the cost is proportional to the number of intersection tests. Which is equal to the number of edges in the ray tree. On the left, we have per eye ray for a total of On the right, we have per eye ray for a total of 128. Thus we expect the one on the right to cost more. Time the two and report the results. Which should work better? The right example seems like it should always be better since there are more samples and there seems to be more information per sample. Yet, the left image looks better. How could this be? It is because the extra samples don’t give us much more infromation? 4 eye rays per pixel 16 shadow rays per eye ray 64 eye rays per pixel 1 shadow ray per eye ray
26
Variance Definition Properties Variance decreases with sample size
27
Direct Lighting – Directional Sampling
Ray intersection Sample uniformly by Sample uniformly by
28
Sampling Projected Solid Angle
Generate cosine weighted distribution
29
Examples Projected solid angle 4 eye rays per pixel 100 shadow rays
Area 4 eye rays per pixel 100 shadow rays
30
Variance Reduction Efficiency measure Techniques Importance sampling
Sampling patterns: stratified, … This could be clearer. Fix the variance. Then the time need to achieve that variance will be n * cost per sample.
31
Sampling a Triangle
32
Sampling a Triangle Here u and v are not independent!
Conditional probability
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.