Direct Illumination & Monte Carlo Integration CS295, Spring - - PowerPoint PPT Presentation

direct illumination
SMART_READER_LITE
LIVE PREVIEW

Direct Illumination & Monte Carlo Integration CS295, Spring - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Direct Illumination & Monte Carlo Integration

CS295, Spring 2017 Shuang Zhao

Computer Science Department University of California, Irvine

CS295, Spring 2017 Shuang Zhao 1

slide-2
SLIDE 2

Announcement

  • Homework 1 will be out on Thursday, Apr 13
  • Check course website for additional readings

CS295, Spring 2017 Shuang Zhao 2

slide-3
SLIDE 3

Last Lecture

  • Radiometry
  • Physics of light
  • BRDFs
  • How materials reflects light

CS295, Spring 2017 Shuang Zhao 3

slide-4
SLIDE 4

Today’s Lecture

  • Direct illumination
  • Monte Carlo integration I

CS295, Spring 2017 Shuang Zhao 4

slide-5
SLIDE 5

Direct Illumination

CS295 Realistic Image Synthesis

CS295, Spring 2017 Shuang Zhao 5

slide-6
SLIDE 6

Direct and Indirect Illumination

CS295, Spring 2017 Shuang Zhao 6

[scratchpixel.com]

Today’s focus

slide-7
SLIDE 7

Recap: BRDF

  • The Bidirectional Reflectance Distribution

Function (BRDF)

CS295, Spring 2017 Shuang Zhao 7

Convention: all vectors point away from x

slide-8
SLIDE 8

Reflected Radiance

CS295, Spring 2017 Shuang Zhao 8

Convention: all vectors point away from x

slide-9
SLIDE 9

Exitant Incident

Incident and Exitant Radiance

  • Lr(x, ωo): all reflected light leaving x (exitant)
  • Li(x, ωi): all light entering x (incident)
  • Other exitant quantities
  • Le(x, ωo): all emitted light leaving x

(nonzero for light sources)

  • L(x, ωo): all light leaving x

CS295, Spring 2017 Shuang Zhao 9

slide-10
SLIDE 10

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

slide-11
SLIDE 11

Direct Illumination

CS295, Spring 2017 Shuang Zhao 11

slide-12
SLIDE 12

Example: Uniform Spherical Light

CS295, Spring 2017 Shuang Zhao 12

Diffuse surface fr(ωi↔ωo) ≡ kd/π Spherical light source with radius r and Le(x,ω) ≡ L0

Recall:

slide-13
SLIDE 13

Example: Uniform Spherical Light

  • For a spherical light source with fixed radiant

power Ф0 (i.e., ):

  • Further, when r goes to zero (point source):

CS295, Spring 2017 Shuang Zhao 13

Recall:

slide-14
SLIDE 14

Computing Direct Illumination

  • Challenges
  • y changes discontinuously with ωi due to occlusion
  • fr can be complicated (e.g., microfacet BRDFs)

CS295, Spring 2017 Shuang Zhao 14

Object 1 Object 2

slide-15
SLIDE 15

Monte Carlo Integration I

CS295 Realistic Image Synthesis

CS295, Spring 2017 Shuang Zhao 15

slide-16
SLIDE 16

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

slide-17
SLIDE 17

Recap: Random Variables

  • (Discrete) random variable X
  • Possible outcomes: x1, x2, …, xn
  • with probabilities p1, p2, …, pn such that
  • E.g., “fair” coin
  • Outcomes: x1 = “head”, x2 = “tail”
  • Probabilities: p1 = p2 = ½

CS295, Spring 2017 Shuang Zhao 17

slide-18
SLIDE 18

Recap: Random Variables

  • (Continuous) random variable X
  • Possible outcomes: [a, b]
  • with probability density p(x) such that

CS295, Spring 2017 Shuang Zhao 18

slide-19
SLIDE 19

Recap: Expected Value & Variance

  • Expected value:
  • Variance:

CS295, Spring 2017 Shuang Zhao 19

slide-20
SLIDE 20

Recap: Expected Value & Variance

Let X and Y be two random variables, then:

CS295, Spring 2017 Shuang Zhao 20

Today’s focus

slide-21
SLIDE 21

Recap: Strong Law of Large Numbers

Let x1, x2, …, xn be n independent observations (aka. samples) of X

CS295, Spring 2017 Shuang Zhao 21

Sample mean “Actual” mean

slide-22
SLIDE 22

Example: Evaluating π

  • Let X be a point uniformly

distributed in the square

  • Probability for X inside S:

π/4

  • Let
  • Then

CS295, Spring 2017 Shuang Zhao 22

Unit circle S Circle area = π Square area = 4

slide-23
SLIDE 23

Example: Evaluating π

  • (Simple) solution for

computing π:

  • Generating n independent

samples of Y based on n i.i.d. X samples

  • Computing their mean

CS295, Spring 2017 Shuang Zhao 23

Unit circle S Circle area = π Square area = 4

slide-24
SLIDE 24

Example: Evaluating π

CS295, Spring 2017 Shuang Zhao 24

Unit circle S Circle area = π Square area = 4

slide-25
SLIDE 25

Integral

  • f(x): one-dimensional function

CS295, Spring 2017 Shuang Zhao 25

slide-26
SLIDE 26

Deterministic Integration

  • Quadrature rules:
  • Problem:
  • Scales poorly with high

dimensionality (more on this

in the next lecture)

CS295, Spring 2017 Shuang Zhao 26

slide-27
SLIDE 27

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

slide-28
SLIDE 28

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

slide-29
SLIDE 29

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

slide-30
SLIDE 30

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

slide-31
SLIDE 31

Monte Carlo Integration “Hello World”

  • Estimating
  • Algorithm:
  • Draw x1, x2, …, xn from U[0, 1) independently
  • Return

CS295, Spring 2017 Shuang Zhao 31

slide-32
SLIDE 32

Monte Carlo Integration “Hello World”

  • Estimating

CS295, Spring 2017 Shuang Zhao 32