44
CS 354 Global Illumination Mark Kilgard University of Texas April 19, 2012

CS 354 Global Illumination

Embed Size (px)

DESCRIPTION

April 19, 2012; CS 354 Computer Graphics; University of Texas at Austin

Citation preview

Page 1: CS 354 Global Illumination

CS 354Global Illumination

Mark KilgardUniversity of TexasApril 19, 2012

Page 2: CS 354 Global Illumination

CS 354 2

Today’s material

In-class quiz On ray casting & tracing lecture

Lecture topic Project 4 Global illumination

Page 3: CS 354 Global Illumination

CS 354 3

My Office Hours

Tuesday, before class Painter (PAI) 5.35 8:45 a.m. to 9:15

Thursday, after class ACE 6.302 11:00 a.m. to 12

Randy’s office hours Monday & Wednesday 11 a.m. to 12:00 Painter (PAI) 5.33

Page 4: CS 354 Global Illumination

CS 354 4

Last time, this time

Last lecture, we discussed Ray casting and tracing

This lecture Global illumination

Projects Project 3 due yesterday Project 4 on ray tracing on Piazza

Due May 2, 2012

Page 5: CS 354 Global Illumination

CS 354 5

Daily Quiz1. Multiple choice: determining

if a ray intersects a sphere involves solving a

a) linear equation

b) quadratic equation

c) system of linear equations

d) cubic equation

2. True or False: With ray tracing, the problem of anti-aliasing doesn’t apply.

3. Multiple choice: With distribution ray tracing, one can accomplish a) depth-of-field

b) soft shadows

c) motion blur

d) a. and b. but not c.

e) a., b., and c.

On a sheet of paper• Write your EID, name, and date• Write #1, #2, #3 followed by its answer

Page 6: CS 354 Global Illumination

CS 354 6

Solving the Rendering Equation with Ray Tracing

Ray “tracing” or “shooting” Given a point and direction, sample radiance Building block for global illumination

algorithms Use ray traces to approximate integrals

Conceptually, solving the rendering equation Intractable to shoot every ray

Instead use Monte Carlo techniques

Page 7: CS 354 Global Illumination

CS 354 7

Aspects of Modeling Light

Geometric optics Our concern Assume light travels instantaneously Light travels in straight lines Light not influenced by gravity or magnetic fields

Wave optics Diffraction, etc.

Quantum optics Sub-microscopic

Page 8: CS 354 Global Illumination

CS 354 8

Rendering Equation

Theory for light-surface interactions

dtLtftLtL ireo )(),,,(),,,,(),,,(),,,( nxxxx

Page 9: CS 354 Global Illumination

CS 354 9

Rendering Equation Parts

Lo = outgoing light from x in direction ω x = point on a surface ω = normalized outgoing light vector λ = wavelength of light t = time Le = emitted light at x going towards from ω n = surface normal at x

dtLtftLtL ireo )(),,,(),,,,(),,,(),,,( nxxxx

Page 10: CS 354 Global Illumination

CS 354 10

Rendering Equation Integral

∫ = integrate over a region Ω = region of a hemisphere

Together: “integrate overall the incoming directions for a hemisphere at a point x”

ωˊ = normalized incoming light vector Li = incoming light at x coming from ωˊ n = surface normal at x (-ωˊ • n) = cosine of angle between incoming

light and surface normal dωˊ = differential of incoming angle

Page 11: CS 354 Global Illumination

CS 354 11

Bidirectional Reflectance Distribution Function

Ratio of differential outgoing (reflected) radiance to differential incoming irradiance

Physically based BRDF properties Must be non-negative Must be reciprocal

Swap incoming & relected directions generates same ratio Conserves energy

Integrating over entire hemisphere must be ≤ 1

dtdL

tdL

tdE

tdLtf

i

r

i

rr )(),,,(

),,,(

),,,(

),,,(),,,,(

nx

x

x

xx

L = radiance

E = irradiance

Page 12: CS 354 Global Illumination

CS 354 12

Cosine Weighting for Irradiance

At shallow angles, incoming light spreads over a wider area of the surface Thus spreading the energy Thus dimming the received light

Page 13: CS 354 Global Illumination

CS 354 13

Measuring BRDFs Empirically

Gonioreflectometer is device to measure BRDFs

Page 14: CS 354 Global Illumination

CS 354 14

BRDF Decomposition

Broad characterization of BRDF appearance

Pure diffuse Pure specular Glossy

Page 15: CS 354 Global Illumination

CS 354 15

Common BRDFs Diffuse model, a.k.a. Lambertian

Phong model, a.k.a. Reflection Specular

Blinn model, a.k.a. Half-angle Specular

ddiffuse ktf ),,,( x

d

n

sblinn kN

HNktf

)(

),,,( x

d

n

sphong kN

Rktf

)(

),,,( x

Page 16: CS 354 Global Illumination

CS 354 16

Hemisphere over a Surface

Incident radiance is integrated over the hemisphere

Page 17: CS 354 Global Illumination

CS 354 17

Rendering Equation Interpretation

Recursive equation

Integral over hemisphere (Ω) Limitations

Treats wavelengths all independent Treats time in Newtonian way Ignores volumetric and subsurface scattering More complex models can incorporate these aspects of light Impractical for actual computer graphics rendering

dtLtftLtL ireo )(),,,(),,,,(),,,(),,,( nxxxx

outgoing light “sums up” all incoming light

for all directions on hemisphere

Page 18: CS 354 Global Illumination

CS 354 18

Alternate Rendering Equation

Integrate over all points in the scene Instead of all directions for a hemisphere

Notes G(x,y) returns the visibility (occlusion) between points x & y Integral over all surface points (Γ) in the scene

yyxyxxx yx

y

yx dGtLtftLtL reo ),(),,,(),,,,(),,,(),,,(

outgoing light “sums up” all incoming light

for all surfaces, modulated by visibility

Page 19: CS 354 Global Illumination

CS 354 19

o

Two Versions ofRendering Equation

dtLtf

tLtL

ir

e

o )(),,,(),,,,(

),,,(),,,( nxx

xx

yyxyx

xx

yx

y

yx dGtLtf

tLtL

r

e

o ),(),,,(),,,,(

),,,(),,,(

Integrate over hemisphere Integrate over all surface points

Occlusion (G) is zero

Page 20: CS 354 Global Illumination

CS 354 20

Discrete Integral Approximation Uniform sampling

Shown in 1D, but we need to integrate over hemisphere (solid angles)

Page 21: CS 354 Global Illumination

CS 354 21

Hemisphere Sampling

Vary Euler angles

Page 22: CS 354 Global Illumination

CS 354 22

Monte Carlo Integrations

Randomly sample the rendering equation integrals Sample space based on probability

distribution function Compute estimated variance to know when to

stop Importance sampling

Try to weight probability function to match variance

Page 23: CS 354 Global Illumination

CS 354 23

Ray Casting for Initial Samples

Page 24: CS 354 Global Illumination

CS 354 24

Path Tracing viaSimple Stochastic Ray Tracing

Page 25: CS 354 Global Illumination

CS 354 25

o

Two Versions ofRendering Equation (again)

dtLtf

tLtL

ir

e

o )(),,,(),,,,(

),,,(),,,( nxx

xx

yyxyx

xx

yx

y

yx dGtLtf

tLtL

r

e

o ),(),,,(),,,,(

),,,(),,,(

Integrate over hemisphere Integrate over all surface points

Occlusion (G) is zero

Page 26: CS 354 Global Illumination

CS 354 26

Sufficient Shadow Ray Sampling

Page 27: CS 354 Global Illumination

CS 354 27

Light Tracing Trace rays from the light

Contribution rays accumulate image samples

Page 28: CS 354 Global Illumination

CS 354 28

Light Tracing Needs Lots of Samples

Page 29: CS 354 Global Illumination

CS 354 29

How many rays to shoot?

Two approaches Fixed number of ray evaluations

Limits the depth of recursion Means some paths can never be explored Implies bias in result, since favors short paths

Russian Roulette approach Roll dice to see if ray tracing should continue Reduces bias in rendering result Allows “obscure” paths to be explored

Page 30: CS 354 Global Illumination

CS 354 30

Radiosity History

Used for thermal engineering since 1960s Introduced to computer graphics in 1984

SIGGRAPH paper: “Modeling the Interaction of Light Between Diffuse Surfaces”

Goral, Torrance, Greenberg, Battaile (Cornell)

Reduces to solving a linear system of equations In simple formulation, just works for diffuse

surfaces OK for building interiors

Page 31: CS 354 Global Illumination

CS 354 31

Radiosity Example

Page 32: CS 354 Global Illumination

CS 354 32

Scene Diced into Uniform Patches

Page 33: CS 354 Global Illumination

CS 354 33

Radiosity Method

Self-emittedSelf-emittedradiosityradiosity

reflectivityreflectivity total total radiosityradiosity

Form factor

Approximation to general Rendering Equation

Page 34: CS 354 Global Illumination

CS 354 34

Form Factors

Form factor between i,j is Fij Tells how much of patch A is visible from patch B Indicates how much radiance can be transferred

i iS S xy

iij dAdAyxK

AF ),(

1

),(),(),( yxVyxGyxK

2

),cos(),cos(),(

xy

yxyxxy

r

NNyxG

yxbetweenvisibilityyxV &),(

Page 35: CS 354 Global Illumination

CS 354 35

Form Factor Visualized

Mutual visibility of two patches Don’t have to be same size

Page 36: CS 354 Global Illumination

CS 354 36

Differential Patches and Foreshortening

Cosine fall-off applies And assuming Lambertian surfaces

foreshortening

Page 37: CS 354 Global Illumination

CS 354 37

Hemi-cube Approach to Sampling Form Factors

Think about drawing hemi-cube at every point What you see is an input for radiosity Known as “instant radiosity”

Page 38: CS 354 Global Illumination

CS 354 38

Interpolation of Radiosity SolutionConstant ApproximationConstant Approximation ““true” solutiontrue” solution Quadratic ApproximationQuadratic Approximation

flat smooth

Page 39: CS 354 Global Illumination

CS 354 39

Iterative Radiosity Solver

1 iteration1 iteration 4 iterations4 iterations 16 iterations16 iterations

64 iterations64 iterations 252 iterations252 iterations

Page 40: CS 354 Global Illumination

CS 354 40

Participating Media Light doesn’t just interact with surfaces

Gaseous phenomena affects lighting Usually handled statistically

absorption

in-scattering

out-scattering

emission[Jarosz et.al. 2008]

[FogShop 2007]

Page 41: CS 354 Global Illumination

CS 354 41

Participating Media Assumptions

Simpler Single scattering Uniform Ignore shadowing

More complex Multiple scatterings Non-uniform Account for shadowing

Page 42: CS 354 Global Illumination

CS 354 42

Photon Mapping

Two-pass global illumination algorithm Developed by Henrick Jensen (1996) Two passes

Randomly distribute photons around the scene Called “photon map construction”

Render treating photons as mini-light sources

Capable of efficiently generating otherwise very expensive effects Caustics Diffuse inter-reflections, such as color bleed Sub-surface scattering

Page 43: CS 354 Global Illumination

CS 354 43

Photon Mapping Examples

caustics

diffuse interreflection

without diffuseinterreflection

photo mapvisualization

sub-surface scattering

Page 44: CS 354 Global Illumination

CS 354 44

Next Class

Next lecture Acceleration structures How do we make the ray trace operation faster?

Reading Chapter 5, 297-298 Chapter 11, 569-577

Project 4 Project 4 is a simple ray tracer Due Wednesday, May 2, 2012