CS-184: Computer Graphics Lecture #23: Global Illumination Prof. - - PowerPoint PPT Presentation

cs 184 computer graphics
SMART_READER_LITE
LIVE PREVIEW

CS-184: Computer Graphics Lecture #23: Global Illumination Prof. - - PowerPoint PPT Presentation

CS-184: Computer Graphics Lecture #23: Global Illumination Prof. James OBrien University of California, Berkeley V2013-F-23-1.0 1 Today The Rendering Equation Radiosity Method Photon Mapping Ambient Occlusion 2 2 Monday,


slide-1
SLIDE 1

CS-184: Computer Graphics

Lecture #23: Global Illumination

  • Prof. James O’Brien

University of California, Berkeley

V2013-F-23-1.0

2

Today

  • The Rendering Equation
  • Radiosity Method
  • Photon Mapping
  • Ambient Occlusion

1 2 Monday, November 25, 13

slide-2
SLIDE 2

local only soft shadows caustics indirect illumination

3 4

The Rendering Equation

Ls(x,x0) = δ(x,x0)  E(x,x0)+

Z

Sρx0(x,x00)Ls(x0,x00)cos(θ0)cos(θ00)

||x0 x00||2 dx00

  • ˆ

n0 ˆ n00 x00 x0 x θ0 θ00

The light shining on x from x’ is equal to:

  • the emitted light from x’ toward x, plus
  • for each bit of surface in the scene, how much light shines from

that bit onto x’ and is reflected toward x, scaled appropriately 3 4 Monday, November 25, 13

slide-3
SLIDE 3

scaled down by distance and relative

  • rientation (“form factor”)

scaled down by the BRDF of x’ Light emitted from x’’ toward x’ sum over every bit of surface in the scene Light emitted from x’ toward x Can x see x’ ? Light energy hitting x from x’

5

The Rendering Equation

ˆ n0 ˆ n00 x00 x0 x θ0 θ00

Ls(x,x0) = δ(x,x0)  E(x,x0)+

Z

Sρx0(x,x00)Ls(x0,x00)cos(θ0)cos(θ00)

||x0 x00||2 dx00

  • 6

Radiosity

  • Assume all materials are perfectly Lambertian (diffuse only,

no specularities)

  • Removes all dependance on directions
  • Reduces dimensionality of lightfield
  • Allows a FEM solution (break up into chunks)
  • Can also relax assumption slightly...

5 6 Monday, November 25, 13

slide-4
SLIDE 4

from Hanrahan 2000

Early radiosity

7 8

Assume Lambertian

ˆ n0 ˆ n00 x00 x0 x θ0 θ00

Ls(x,x0) = δ(x,x0)  E(x,x0)+

Z

Sρx0(x,x00)Ls(x0,x00)cos(θ0)cos(θ00)

||x0 x00||2 dx00

  • Ls(x,x0) = δ(x,x0)

 Ex0 +

Z

Sρx0Ls(x0,x00)cos(θ0)cos(θ00)

||x0 x00||2 dx00

  • Only term dependent on x

7 8 Monday, November 25, 13

slide-5
SLIDE 5

9

Rewrite in Terms of Radiosity

ˆ n0 ˆ n00 x00 x0 x θ0 θ00

Ls(x,x0) = δ(x,x0)  Ex0 +

Z

Sρx0Ls(x0,x00)cos(θ0)cos(θ00)

||x0 x00||2 dx00

  • Note: we changed defn of E here.

Hx0 = Ex0 +ρx0

Z

Sδ(x0,x00)Hx00

2π cos(θ0)cos(θ00) ||x0 x00||2 dx00

10

Discretize into Patches

Example mesh for Cornell Box by Mark Schmelzenbach

Piece-wise constant patches

9 10 Monday, November 25, 13

slide-6
SLIDE 6

11

Discretize into Patches

The Candlestick Theater, Mark Mack Architects.

12

Discretize into Patches

The Candlestick Theater, Mark Mack Architects.

11 12 Monday, November 25, 13

slide-7
SLIDE 7

13

Hi = Ei +ρi∑

j

Hj

Z

S j

δi j cos(θi)cos(θ j) 2π||ci −x||2 dx

Rewrite in Terms of Patches

Pi

Pj

cj ci

Fi j ≈ δi j cos(θi)cos(θ j) 2π||ci −c j||2 A j

Example of a rough approximation:

Fi j Form factor from j to i, Hx0 = Ex0 +ρx0

Z

Sδ(x0,x00)Hx00

2π cos(θ0)cos(θ00) ||x0 x00||2 dx00

14

  • Given the and
  • First compute
  • Then solve
  • Comments:
  • The matrix A is typically very large
  • It is also sparse (why?)
  • Should be solved with an iterative method
  • e.g.: Jacobi or Gauss-Seidel
  • Solution is view independent

Radiosity Method

Hi = Ei +ρi∑

j

HjFi j Ei ρi Fi j h = e+Ah (I−A)h = e 13 14 Monday, November 25, 13

slide-8
SLIDE 8

15

  • Given the light emitted and surface properties
  • First compute , form factors between patches
  • Then solve a linear system to balance energy

between all patches

  • Comments:
  • The system is very large
  • It is also sparse (why?)
  • Should be solved with an iterative method
  • e.g.: Jacobi or Gauss-Seidel
  • Solution is view independent

Radiosity Method

Fi j

16

Progressive Radiosity

  • If magnitude of eigenvalues of A<1
  • True for form-factor matrices
  • Use Gauss-Seidel-like iteration but reorder by priority

(I−A)−1 = I+A+A2 +A3 +··· hk+1 = hk +uk+1 h0 = 0 u0 = e uk+1 = Auk

Southwell Relaxation

Idea: let important sources

  • f light energy emit first, maybe

don’t even bother with dark things

15 16 Monday, November 25, 13

slide-9
SLIDE 9

17

Progressive Radiosity

From dissertation "Efficient and predictive realistic image synthesis" by Karol Myszkowski

18

Touchup

  • Each patch will have a constant color
  • Smooth solution (e.g. average to vertices)

Example mesh for Cornell Box by Mark Schmelzenbach Does not match but you get the idea...

17 18 Monday, November 25, 13

slide-10
SLIDE 10

19

Other Things

  • Each patch will have a constant color
  • Smooth solution (e.g. average to vertices)
  • No specular reflection
  • Add Phong specular term or raytraced specular reflection
  • Grid artifacts
  • Be clever with grid...

20

Hierarchical Radiosity

  • Light smoothes with distance
  • Compare with as gets large

1/h2 1/(h2 +d2)

h

19 20 Monday, November 25, 13

slide-11
SLIDE 11

21

Hierarchical Radiosity

  • Light smoothes with distance
  • Compare with as gets large
  • Group patches into hierarchy
  • Far interactions use lower-res form factors

1/h2 1/(h2 +d2)

h

22

Computing Form Factors

  • Form factors have a geometric meaning

Images from SIGGRAPH 93 Education Slide Set by Stephen Spencer

21 22 Monday, November 25, 13

slide-12
SLIDE 12

23

Computing Form Factors

  • Form factors have a geometric meaning
  • “Hemicube” algorithm uses regular scan conversion

Images from SIGGRAPH 93 Education Slide Set by Stephen Spencer

24

Computing Form Factors

  • Form factors have a geometric meaning
  • “Hemicube” algorithm uses regular scan conversion
  • Also computed by ray-based sampling
  • In practice, computing form factors is the

bottleneck

23 24 Monday, November 25, 13

slide-13
SLIDE 13

25

Photon Mapping

  • Lights cast “photons” into environment
  • Cast in random directions
  • Trace into environment
  • Store records at intersections

26

Photon Mapping

  • Lights cast “photons” into environment
  • Cast in random directions
  • Trace into environment
  • Store records at intersections
  • With KD-Trees...

25 26 Monday, November 25, 13

slide-14
SLIDE 14

Comparison

27

Ray Tracing Ray Tracing w/ Photon Map

Catherine Bendebury and Jonathan Michaels CS 184 Spring 2005

28

Photon Mapping

Image by Per Christensen

A ray traced image Note: Dark shadows Unlit corners Nice reflections

27 28 Monday, November 25, 13

slide-15
SLIDE 15

29

Photon Mapping

Image by Per Christensen

Raw photons Note: Noisy Sparse

30

Photon Mapping

Image by Per Christensen

Interpolated Photons Note: Still noisy Biased

29 30 Monday, November 25, 13

slide-16
SLIDE 16

31

Photon Mapping

Image by Per Christensen

Interpolated Photons (multiplied by diffuse) Note: Still noisy Biased

32

Photon Mapping

  • Final Gather
  • Ray trace scene
  • Direct and specular rays as normal
  • Diffuse rays traced into photon map
  • Diffuse reflection smoothes noise

31 32 Monday, November 25, 13

slide-17
SLIDE 17

33

Photon Mapping

Image by Per Christensen

Final Image Note: Not noisy Nice lighting Reflections May still be biased Final gather often bottleneck...

34

Ambient Occlusion

  • A “hack” to create more realistic ambient illumination

cheaply

  • Assume light from everywhere is partially blocked by local
  • bjects
  • At a point on the surface cast rays at random
  • Ambient term is proportional to percent of rays that hit nothing
  • Weight average by cosine of angle with normal
  • Take into account how far before occluded

33 34 Monday, November 25, 13

slide-18
SLIDE 18

35

Ambient Occlusion

36

Ambient Occlusion

Diffuse Only Ambient Occlusion Combined

35 36 Monday, November 25, 13

slide-19
SLIDE 19

37

Ambient Occlusion

nVidia Gelato Demo Image

37 Monday, November 25, 13