11.1 global illumination8 soft shadows shadows are much darker where the direct and indirect...

58
1 11.1 Global Illumination Fall 2015 CSCI 420: Computer Graphics Hao Li / Chloe LeGendre http://cs420.hao-li.com

Upload: others

Post on 23-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

1

11.1 Global Illumination

Fall 2015

CSCI 420: Computer Graphics

Hao Li / Chloe LeGendre

http://cs420.hao-li.com

Page 2: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Global Illumination

The Blue Umbrella © Pixar 2013

Page 3: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Global Illumination

The Blue Umbrella © Pixar 2013

Page 4: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Global Illumination

The Blue Umbrella © Pixar 2013

Page 5: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

5

Global Illumination

• Lighting based on the full scene

• Lighting based on physics (optics)

• Traditionally represented by two algorithms

– Raytracing – 1980

– Radiosity – 1984

• More modern techniques include photon mapping and many variations of raytracing and radiosity ideas

5

Page 6: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

6

Direct Illumination vs. Global Illumination

• reflected, scattered and transmitted light

• many (infinite) number of bounces

• physically based light transport

• single (or few) bounces of the light only

• for example, ray casting

• no recursion (or shallow recursion only)

• fast lighting calculations based on light and

normal vectors

Page 7: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Indirect Illumination

Color Bleeding7

Page 8: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

8

Soft Shadows

Shadows are much darker where the direct and indirect illuminations are

occluded. Such shadows are important for “sitting” the sphere in the scene.

They are difficult to fake without global illumination. 8

Page 9: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Soft Shadows

Soft shadows must be faked when using point light sources.

Page 10: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

• Refractive:

Transmitted light that

refocuses on a surface,

usually in a pretty pattern

• Reflective:

Reflected light that refocuses

on a surface

• Not present with direct

illumination

10

Caustics

Page 11: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Caustics

Caustics on the set of Bladerunner 2049

Page 12: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Light Paths L = Light

E = Eye (camera)

D = Diffuse

S = Specular

www.scratchapixel.com

Page 13: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

13

Light Transport and Global Illumination

• Diffuse to diffuse (LD*E)

• Diffuse to specular (LDSE)

• Specular to diffuse (LSDE)

• Specular to specular (LSSE)

• Ray tracing (viewer dependent)

– Light to diffuse [backward: EDL ]

– Specular to specular … [backward: E(S*)(D)L ]

• Radiosity (viewer independent)

– Diffuse to diffuse [ED*L]

13

Page 14: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Path Types (behavior of global illumination)

• OpenGL (“local”)

– L(D|S)E

• Ray Tracing

– ES*DL

• Radiosity

– ED*L

• Path Tracing

– attempts to trace

“all rays” in a scene

14

Page 15: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

15

Images Rendered With Global Illumination

• Caustics

• Color bleeding

• Area light sources and soft shadows

Page 16: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

16

Outline

• Direct and Indirect Illumination

• Bidirectional Reflectance Distribution Function

• Raytracing and Radiosity

• Subsurface Scattering

• Photon Mapping

16

Page 17: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Solid Angle

• 2D angle subtended by object O from point x:

– Length of projection onto unit circle at x

– Measured in radians (0 to 2p)

• 3D solid angle subtended by O from point x:

– Area of of projection onto unit sphere at x

– Measured in steradians (0 to 4p)

J. Stewart17

Page 18: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Light and Surfaces

• Radiance (L): Power (φ) per unit area per unit solid angle

– Measured in W / m2str

– dA is projected area (perpendicular to given direction)

• Irradiance: Power received per unit area,integrated over all directions

– Measured in W / m2

• Radiosity (B): Power emitted/reflected/transmitted per unit area, integrated over all directions

– Measured in W / m2

18

Page 19: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Bidirectional Reflectance Distribution Function (BRDF)

19

If a ray hits a

surface point at

angle wi, how

much light

bounces into the

direction given by

angle wo?

It depends on the

type of material.

Page 20: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

20

Bidirectional Reflectance Distribution

• General model of light reflection

• Hemispherical function

• 6-dimensional (2-DOF location, 4 angles)

A. Wilkie

20

x,y

θ , Φ incoming

θ , Φ outgoing

Page 21: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

21

BRDF Examples

• BRDF is a property of the material

• There is no formula for mostmaterials

• Measure BRDFs for different materials (and store in a table)

Ideal Specular Ideal Diffuse

Rough Specular Directional Diffuse21

Page 22: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

22

Material Examples

Marschner et al. 2000

22

Page 23: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

23

BRDF Isotropy

• Rotation invariance of BRDF

• Reduces 4 angles to 2

• Holds for a wide variety of surfaces

• Anisotropic materials

– Brushed metal

– Others?

17

Page 24: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Rendering Equation

• L is the radiance from a point x on a surface in a given direction ω

• E is the emitted radiance from a point: E is non-zero only if x is emissive

• fr is the BRDF (6 DOF)

• G is a geometry term, which depends on the geometric relationship (such as distance) between the two surfaces x and x’

• V is a visibility term: 1 when the surfaces are unobstructed along the direction ω, 0 otherwise

• It includes contributions from light bounced many times off surfaces

18

Page 25: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

25

Outline

• Direct and Indirect Illumination

• Bidirectional Reflectance Distribution Function

• Raytracing and Radiosity

• Subsurface Scattering

• Photon Mapping

25

Page 26: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

26

Raytracing

From: http://jedi.ks.uiuc.edu/~johns/raytracer/raygallery/stills.html 26

Page 27: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

27

Raytracing

Albrecht DÜRER,

Underweysung der Messung mit dem Zirkel und Richtscheyt

(Nurenberg, 1525), Book 3, figure 67.

27

Page 28: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

28

Raycasting vs. Raytracing

Raycasting Raytracing

28

Page 29: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

29

Raytracing: Pros

• Simple idea and nice results

• Inter-object interaction possible

– Shadows

– Reflections

– Refractions (light through glass, etc.)

• Based on real-world lighting

29

Page 30: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

30

Raytracing: Cons

• Slow

• Speed often highly scene-dependent

• Lighting effects tend to be abnormally sharp,

without soft edges, unless more advanced

techniques are used

• Hard to put into hardware

30

Page 31: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

31

Supersampling I

• Problem: Each pixel of the display represents one

single ray

– Aliasing

– Unnaturally sharp images

• Solution: Send multiple rays through each “pixel”

and average the returned colors together

31

Page 32: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

32

Supersampling II

• Direct supersampling– Split each pixel into a grid and send rays through

each grid point

• Adaptive supersampling– Split each pixel only if it’s significantly different from its

neighbors (image space)

• Jittering– Send rays through randomly selected points within

the pixel

32

Page 33: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

33

The Radiosity Method

Cornell University 33

Page 34: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

34

The Radiosity Method

• Divide surfaces into patches(e.g., each triangle is one patch)

• Model light transfer between patches as system of linear equations

• Important assumptions:

– Diffuse reflection only E(D*)L

– No specular reflection

– No participating media (no fog)

– No transmission (only opaque surfaces)

– Radiosity is constant across each patch

– Solve for R, G, B separately

34

Page 35: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

35

(Idealized) Radiosity Computation

Form factor

calculation

Solution of

radiosity eqn

Visualization

Scene

Geometry

Reflectance Properties

Viewing Conditions

Radiosity

Image

Division into

patches

35

Page 36: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

36

Radiosity: Pros

• Can change camera position and re-render with

minimal re-computation (viewpoint independence)

• Inter-object interaction possible

– Soft shadows

– Indirect lighting

– Color bleeding

• Accurate simulation of energy transfer

36

Page 37: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

37

Radiosity: Cons

• Precomputation must be re-done if anything moves

• Large computational and storage costs

• Non-diffuse light not represented– Mirrors and shiny objects hard to include

• Lighting effects tend to be “blurry” (not sharp)

• Not applicable to procedurally defined surfaces

37

Page 38: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

38

Radiosity Equation

• For each patch i:

• Variables

– Bi = radiosity (unknown)

– Ei = emittance of light sources (given; some patches are

light sources)

ri = reflectance (given)

– Fij = form factor from i to j (computed)

fraction of light emitted from patch i arriving at patch j

– Ai = area of patch i (computed)

38

Page 39: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

The Form Factor

39

Fij is dimensionless

Vij = 0 if occluded

1 if not occluded

(visibility factor)

Page 40: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

40

Radiosity Example

Museum simulation. Program of Computer Graphics, Cornell University.

50,000 patches. Note indirect lighting from ceiling. 40

Page 41: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

41

Outline

• Direct and Indirect Illumination

• Bidirectional Reflectance Distribution Function

• Raytracing and Radiosity

• Subsurface Scattering

• Photon Mapping

41

Page 42: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

42

Subsurface Scattering

• Translucent objects: skin, marble, milk

• Light penetrates the object, scatters and exits

• Important and popular in computer graphics

42

Page 43: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

43

Subsurface Scattering

• Jensen et al. 2001

Using only BRDF With subsurface light transport

43

Page 44: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

44

Subsurface Scattering

direct only subsurface

scattered onlycombined

44

Page 45: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

45

Outline

• Direct and Indirect Illumination

• Bidirectional Reflectance Distribution Function

• Raytracing and Radiosity

• Subsurface Scattering

• Photon Mapping

45

Page 46: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

46

Photon Mapping

From http://graphics.ucsd.edu/~henrik/images/global.html46

Page 47: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

47

Photon Mapping Basics

• Enhancement to raytracing

• Can simulate caustics

• Can simulate diffuse inter-reflections (e.g., the "bleeding" of colored light from a red wall onto a white floor, giving the floor a reddish tint)

• Can simulate clouds or smoke

47

Page 48: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

48

Photon Mapping

• “Photons” are emitted (raytraced) from light sources

• Photons either bounce or are absorbed

• Photons are stored in a photon map,with both position and incoming direction

• Photon map is decoupled from the geometry(often stored in a kd-tree)

Photon Map

48

Page 49: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

49

Photon Mapping

• Raytracing step uses the closest N photons to each ray intersection and estimates the outgoing radiance

• Specular reflections can be done using “usual” raytracing to reduce the number of photons needed

• Numerous extensions to the idea to add more complex effects

49

Page 50: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

50

Photon Mapping: Pros

• Preprocessing step is view independent, so only needs to be re-done if the lighting or positions of objects change

• Inter-object interaction includes:

– Shadows

– Indirect lighting

– Color bleeding

– Highlights and reflections

– Caustics – current method of choice

• Works for procedurally defined surfaces

50

Page 51: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

51

Photon Mapping: Cons

• Still time-consuming, although not as bad as

comparable results from pure raytracing

• Photon map not easy to update if small changes

are made to the scene

51

Page 52: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

52

Photon Mapping Example

224,316 caustic photons,

3095 global photons52

Page 53: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Photon Mapping Example

53

Page 54: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

54

Summary

• Direct and Indirect Illumination

• Bidirectional Reflectance Distribution Function

• Raytracing and Radiosity

• Subsurface Scattering

• Photon Mapping

54

Page 55: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Extras

• Global Illumination for games / real-time: https://docs.unity3d.com/Manual/GIIntro.html

“baking light maps” – pre-compute GI for real-time applications for any static scene elements

• Ambient Occlusion: How exposed is each point in a scene to ambient lighting? (not the ambient term in Phong shading)

Page 56: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Ambient Occlusion

(Arnold GI renderer)

Page 57: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

Image-based Lighting

(Photographs capture

real-world light, which

can be used for rendering)

[Paul Debevec, USC ICT]

Image-based

Lighting

Page 58: 11.1 Global Illumination8 Soft Shadows Shadows are much darker where the direct and indirect illuminations are occluded. Such shadows are important for “sitting” the sphere in

GI Light Types

[Arnold renderer]