Direct Illumination & Monte Carlo Integration CS295, Spring 2017 Shuang Zhao Computer Science Department University of California, Irvine CS295, Spring 2017 Shuang Zhao 1
Announcement • Homework 1 will be out on Thursday, Apr 13 • Check course website for additional readings CS295, Spring 2017 Shuang Zhao 2
Last Lecture • Radiometry • Physics of light • BRDFs • How materials reflects light CS295, Spring 2017 Shuang Zhao 3
Today’s Lecture • Direct illumination • Monte Carlo integration I CS295, Spring 2017 Shuang Zhao 4
Direct Illumination CS295 Realistic Image Synthesis CS295, Spring 2017 Shuang Zhao 5
Direct and Indirect Illumination Today’s focus [scratchpixel.com] CS295, Spring 2017 Shuang Zhao 6
Recap: BRDF • The B idirectional R eflectance D istribution F unction (BRDF) Convention: all vectors point away from x CS295, Spring 2017 Shuang Zhao 7
Reflected Radiance Convention: all vectors point away from x CS295, Spring 2017 Shuang Zhao 8
Incident and Exitant Radiance Exitant Incident • L r ( x , ω o ): all reflected light leaving x (exitant) • L i ( x , ω i ): all light entering x (incident) • Other exitant quantities • L e ( x , ω o ) : all emitted light leaving x (nonzero for light sources) • L ( x , ω o ) : all light leaving x CS295, Spring 2017 Shuang Zhao 9
Incident and Exitant Radiance • In general: • y is computed by tracing a ray from x in direction ω • Recap: invariant of radiance (in vacuum) CS295, Spring 2017 Shuang Zhao 10
Direct Illumination CS295, Spring 2017 Shuang Zhao 11
Example: Uniform Spherical Light Spherical light source with radius r and L e ( x , ω ) ≡ L 0 Diffuse surface f r ( ω i ↔ ω o ) ≡ k d / π Recall: CS295, Spring 2017 Shuang Zhao 12
Example: Uniform Spherical Light • For a spherical light source with fixed radiant power Ф 0 (i.e., ): • Further, when r goes to zero (point source): Recall: CS295, Spring 2017 Shuang Zhao 13
Computing Direct Illumination • Challenges • y changes discontinuously with ω i due to occlusion Object 1 Object 2 • f r can be complicated (e.g., microfacet BRDFs) CS295, Spring 2017 Shuang Zhao 14
Monte Carlo Integration I CS295 Realistic Image Synthesis CS295, Spring 2017 Shuang Zhao 15
Monte Carlo Integration • A powerful framework for computing integrals • Numerical • Nondeterministic (i.e., using randomness) • Scalable to high-dimensional problems CS295, Spring 2017 Shuang Zhao 16
Recap: Random Variables • (Discrete) random variable X • Possible outcomes: x 1 , x 2 , …, x n • with probabilities p 1 , p 2 , …, p n such that • E.g., “fair” coin • Outcomes: x 1 = “head”, x 2 = “tail” • Probabilities: p 1 = p 2 = ½ CS295, Spring 2017 Shuang Zhao 17
Recap: Random Variables • (Continuous) random variable X • Possible outcomes: [ a , b ] • with probability density p ( x ) such that CS295, Spring 2017 Shuang Zhao 18
Recap: Expected Value & Variance • Expected value: • Variance: CS295, Spring 2017 Shuang Zhao 19
Recap: Expected Value & Variance Let X and Y be two random variables, then: Today’s focus CS295, Spring 2017 Shuang Zhao 20
Recap: Strong Law of Large Numbers Let x 1 , x 2 , …, x n be n independent observations (aka. samples ) of X “Actual” mean Sample mean CS295, Spring 2017 Shuang Zhao 21
Example: Evaluating π • Let X be a point uniformly distributed in the square • Probability for X inside S : Unit circle π /4 S • Let • Then Circle area = π Square area = 4 CS295, Spring 2017 Shuang Zhao 22
Example: Evaluating π • (Simple) solution for Unit circle computing π : S • Generating n independent samples of Y based on n i.i.d. X samples • Computing their mean Circle area = π Square area = 4 CS295, Spring 2017 Shuang Zhao 23
Example: Evaluating π Unit circle S Circle area = π Square area = 4 CS295, Spring 2017 Shuang Zhao 24
Integral • f(x): one-dimensional function CS295, Spring 2017 Shuang Zhao 25
Deterministic Integration • Quadrature rules: • Problem: • Scales poorly with high dimensionality (more on this in the next lecture) CS295, Spring 2017 Shuang Zhao 26
Monte Carlo Integration: Overview • Goal: Estimating • Idea: Constructing random variable • Such that • is called an unbiased estimator of • But how? CS295, Spring 2017 Shuang Zhao 27
Monte Carlo Integration • Let p () be any probability density function over [ a , b ] and X be a random variable with density p • Let , then: • To estimate : strong law of large numbers CS295, Spring 2017 Shuang Zhao 28
Monte Carlo Integration • Goal: to estimate • Pick a probability density function • Generate n independent samples: • Evaluate for j = 1, 2, …, n • Return sample mean: CS295, Spring 2017 Shuang Zhao 29
How to pick density function p ()? • In theory • (Almost) anything • In practice: • Uniform distributions (almost) always work • As long as the domain is bounded • Choice of p() greatly affects the effectiveness (i.e., convergence rate) of the resulting estimator • More in later lectures CS295, Spring 2017 Shuang Zhao 30
Monte Carlo Integration “Hello World” • Estimating • Algorithm: • Draw x 1 , x 2 , …, x n from U[0, 1) independently • Return CS295, Spring 2017 Shuang Zhao 31
Monte Carlo Integration “Hello World” • Estimating CS295, Spring 2017 Shuang Zhao 32
Recommend
More recommend