+ All Categories
Home > Documents > Shading, lighting, & BRDF...

Shading, lighting, & BRDF...

Date post: 20-Mar-2018
Category:
Upload: hakien
View: 221 times
Download: 1 times
Share this document with a friend
54
Shading, lighting, & BRDF Theory Cliff Lindsay, PHD
Transcript
Page 1: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Shading, lighting, & BRDF Theory Cliff Lindsay, PHD

Page 2: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Overview of today’s lecture

• BRDF Characteristics

• Lights in terms of BRDFs

• Classes of BRDFs

• Ambient light & Shadows in terms of BRDFs

Tomas Akenine-Mőller © 2002

Page 3: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Decomposing Reflection

• Phong = Amb + Diff + Spec

• Don’t Confuse Phong Shading

Tomas Akenine-Mőller © 2002

Page 4: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Refresher on lighting Diffuse component : idiff

• i=iamb+idiff+ispec

• Diffuse is Lambert’s law:

Tomas Akenine-Mőller © 2002

cos lndiffi

Photons are scattered equally in all

directions

diffdiffdiff smlni )(

Page 5: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Lighting

Specular component : ispec

• Diffuse is dull (left)

• Specular: simulates a highlight

Tomas Akenine-Mőller © 2002

Page 6: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Specular component: Phong • Phong specular highlight model

Tomas Akenine-Mőller © 2002

Reflect l around n: l)n2(nlr

n

l r

-l

nln )(

ln shishi mm

speci )(cos)( vr

specspec

m

specshi smvri ))(,0max(

Read about Blinns highlight formula: (n.h)m

Page 7: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Ambient component: iamb

• Ad-hoc – tries to account for light coming from other surfaces

• Just add a constant color:

Tomas Akenine-Mőller © 2002

ambambamb smi

Page 8: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Lighting i=iamb+idiff+ispec

• This is just a hack!

• Has little to do with how reality works! Tomas Akenine-Mőller © 2002

+ +

=

Page 9: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

What’s lighting and what’s shading?

• Lighting: the interaction between light and matter

• Shading: do lighting (at vertices) and determine pixel’s colors from these

• Three types of shading:

– Flat, Goraud, and Phong

Tomas Akenine-Mőller © 2002

Page 10: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Now Some Info About Lights

Tomas Akenine-Mőller © 2002

Page 11: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Additions to the lighting equation • Depends on distance: 1/(a+bt+ct )

• Can have more lights: just sum their respective contributions

• Different light types:

Tomas Akenine-Mőller © 2002

2

Page 12: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Lights

Tomas Akenine-Mőller © 2002

Directional Omni with falloff Spotlight

2r

IE

r

pspll

psplr

LL

Omni

Page 13: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Falloff

Tomas Akenine-Mőller © 2002

2

1

rsrssf

qlc

dist

0

,

,1

startend

enddist

rr

rrf

OpenGL way

Typical for Games

Page 14: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Spotlights

Tomas Akenine-Mőller © 2002

0

)(*)(

exps

LL

lsIlI

S- angle

P-penumbra

U - cutoff

Page 15: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

BRDF Theory

Ratio between incoming and outgoing light

Tomas Akenine-Mőller © 2002

v l

)cos()(

)(),(

i

o

lE

vLvlf

Outgoing

Incoming

Think of f(l,v) as a function

Page 16: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

BRDFs – Better Modeling • Better Modeling:

– Diffuse – define better diffuse

– Specular – different types of specular

– Ambient – beyond just simple Phong ambient

Tomas Akenine-Mőller © 2002

Page 17: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

What We’ve Done Already

• For Phong Reflectance – We calculate Lo = f(l,v)*E(l)*cos(i) – Phong = i*mat+i*NL*mat+i*(NR)m*mat

Tomas Akenine-Mőller © 2002

)cos()(

)(),(

i

o

lE

vLvlf

f(l,v) f(l,v) E(l) E(l) E(l)

Page 18: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

BRDF Theory • Generally Parameterized by:

– i - incoming – o – outgoing – n – Normal – V – View Vector – L – Light Vector

Tomas Akenine-Mőller © 2002

Easy to param based on

two quantities

Page 19: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

BRDF Characteristics

• Helmholtz Reciprocity

Tomas Akenine-Mőller © 2002

),(),( lvfvlf

Conservation of Energy

• What comes in, must go ?

- Out

- Absorbed

- Scattered

Page 20: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Light Material Interaction

Tomas Akenine-Mőller © 2002

Surface Interaction Sub-Surface Interaction

When Light Hits Material:

• Interacts with surface

• Goes through surface an interacts below surface

• Independent of color (most of time for us)

Page 21: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Fresnel Reflectance

Tomas Akenine-Mőller © 2002

Governs interface between two surfaces

• ri is the ideal reflection (look familiar?)

• t is the ideal refraction

•Snell’s Law (n1sin(i) = n2 sin(t) )

•i = 90, glancing angle produces white color

Page 22: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Fresnel Example

Tomas Akenine-Mőller © 2002

Page 23: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Which Would You Drink?

Tomas Akenine-Mőller © 2002

Page 24: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Subsurface Scattering

• Very Important for flesh • Most organic materials exhibit • Lots of other materials too

Tomas Akenine-Mőller © 2002

Without With

Page 25: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Micro-Geometry

Tomas Akenine-Mőller © 2002

Page 26: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Micro-geometry

A. Self Shadowing

B. Masking

C. Interreflection (self)

Tomas Akenine-Mőller © 2002

A B C

Page 27: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Example: Micro-Geometry

Retro-Reflection

Tomas Akenine-Mőller © 2002

Page 28: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Micro-facet

• Special Case Micro-geometry – Facets Assumed to be ideal mirrors – Uses Half-vector h (half-way vector) – NDF: Normal Distribution Function p(h) – Introduces Geometry Factor G(l,v)

Tomas Akenine-Mőller © 2002

Page 29: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Micro-facet • Incorporates:

– NDF – distribution of facets on surface – Geometry – surface geometry – Fresnel

Tomas Akenine-Mőller © 2002

)cos()cos(4

)(),()(),(

oip

h

k

RfvlGhpvlf

Page 30: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Example BRDFs

• Modified Phong

Tomas Akenine-Mőller © 2002

,

0

)cos(

)cos(*

),(

i

m

rmatmat

vlf

,)cos(*

),(

m

rmatmatvlf

Old Phong

Physically Accurate

Phong

Page 31: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Simple Visibility

• Many BRDFs (especially game ones) have no visibility term at all

• This means the visibility term = 1

• Implies geometry factor = nl * nv.

Tomas Akenine-Mőller © 2002

Page 32: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Torrance Sparrow Geometry • invented by Blinn in 1975 as a reformulation of the Torrance-

Sparrow • based on an micro-geometry model • not affected by roughness

Tomas Akenine-Mőller © 2002

Page 33: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

More Geometry Factors

• Kelemen-Szirmay-Kalos Geometry Factor

• Has cheap and effective approximation

Tomas Akenine-Mőller © 2002

Page 34: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Rougher = Blurrier

Tomas Akenine-Mőller © 2002

Page 35: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Smith Geometry Factor

kkkkGsmith

o

o

i

i

)1(cos

cos

)1(cos

cos

Tomas Akenine-Mőller © 2002

Incorporates roughness into Geometry Term

k=(2m2/)

Roughness

Page 36: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Many Different Things To Consider

Tomas Akenine-Mőller © 2002

Page 37: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Samples from real-world materials

Tomas Akenine-Mőller © 2002

Page 38: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Demo

Tomas Akenine-Mőller © 2002

Page 39: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

More Geometry Factor

Instead of general inclusion within the BRDF We can account for geometry for each geometry specifically

Tomas Akenine-Mőller © 2002

Phong Ambient Ambient Occlusion AO + GI Light

Page 40: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Ambient Occlusion

• At surface points P shoot out rays

– If we hit something shelf-shadow

– If not, calculate lighting (NL) or something

• Incorporate into reflectance function

Tomas Akenine-Mőller © 2002

Page 41: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

AO

• Light = local hemisphere

– Centered at current surface point

– Radius = user parameter

• Can be rendered with ray tracing

• Gives perceptual clues of depth, curvature and spatial proximity

• Lots of techniques (For Games: Screen Space,

Horizon-Based, Image-Space)

Tomas Akenine-Mőller © 2002

Page 42: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Example

Tomas Akenine-Mőller © 2002

Page 43: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Other Illumination Models Cliff Lindsay

Page 44: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Overview of today’s lecture

• Refresher on simple lighting models

– Plus some new stuff

• More Advanced Illumination Models

Tomas Akenine-Mőller © 2002

Page 45: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Additions to the lighting equation • Depends on distance: 1/(a+bt+ct )

• Can have more lights: just sum their respective contributions

• Different light types:

Tomas Akenine-Mőller © 2002

2

Page 46: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

What’s lighting and what’s shading?

• Lighting: the interaction between light and matter

• Shading: do lighting (at vertices) and determine pixel’s colors from these

• Three types of shading:

– Flat, Goraud, and Phong

Tomas Akenine-Mőller © 2002

Page 47: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Global Models

You have seen:

• Local illumination model: Phong – Ambient

– Diffuse

– Specular

– Point light sources

– No: shadows, inter-object light reflection.

• “More global” illumination model: Ray Tracing – Shadows

– Area light sources (via distributed ray tracing)

– inter-object light reflection

Tradeoffs:

• Improvements in fidelity come at the expense of computational complexity.

Tomas Akenine-Mőller © 2002

Page 48: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Realistic rendering

• For each visible point p in the scene

– How much light is reflected towards the camera

Tomas Akenine-Mőller © 2002

Page 49: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Direct + Indirect

Tomas Akenine-Mőller © 2002

p

Page 50: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Local vs. Global

Tomas Akenine-Mőller © 2002

Page 51: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Indirect Light

• Direct-only

• 1-bounce indirect

• 2-bounce indirect

Tomas Akenine-Mőller © 2002

Page 52: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Ray Tracing

Tomas Akenine-Mőller © 2002

Page 53: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Different Ways to Achieve GI

• Ray Tracing

• Path Tracing

• Photon Mapping

• Radiosity

• Metropolis Light Transport

Tomas Akenine-Mőller © 2002

Page 54: Shading, lighting, & BRDF Theoryusers.wpi.edu/~clindsay/teaching/CS4731A2015/graphics_lect8.pdfOverview of today’s lecture •BRDF Characteristics •Lights in terms of BRDFs •Classes

Put it all together

Tomas Akenine-Mőller © 2002


Recommended