44
MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler Local Illumination

Embed Size (px)

Citation preview

Page 1: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Local Illumination

Page 2: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Outline

• Introduction

• Radiometry

• Reflectance

• Reflectance Models

Page 3: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Big Picture

Page 4: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Radiometry

• Energy of a photon

• Radiant Energy of n photons

• Radiation flux (electromagnetic flux, radiant flux) Units: Watts

dt

dQ

sm csJhhc

e /103 1063.6 834

n

i i

hcQ

1

Page 5: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Radiometry

ddA

dL

cos)(

2

steradianmeter

WattUnits

:

2

• Radiance – radiant flux per unit solid angle per unit projected area– Number of photons arriving

per time at a small area

from a particular direction

Page 6: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Radiometry

• Irradiance – differential flux falling onto differential area

• Irradiance can be seen as a density of the incident flux falling onto a surface.

• It can be also obtained by integrating the radiance over the solid angle.

dA

dE

2

:meter

WattUnits

Page 7: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Light Emission

• Light sources: sun, fire, light bulbs etc.

• Consider a point light source that emits light uniformly in all directions

Surface

n

sourcelight the todistance

sourcelight theofpower 4

4

cos22

d

dL

dE

s

ss

Page 8: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Outline

• Introduction

• Radiometry

• Reflectance

• Reflectance Models

Page 9: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Reflection & Reflectance

• Reflection - the process by which electromagnetic flux incident on a surface leaves the surface without a change in frequency.

• Reflectance – a fraction of the incident flux that is reflected

• We do not consider:– absorption, transmission, fluorescence

– diffraction

Page 10: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Reflectance

• Bidirectional scattering-surface distribution Function (BSSRDF)

Surface

Source: Jensen et.al 01

Page 11: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Reflectance

• Bidirectional scattering-surface distribution Function (BSSRDF)

),,,(

),,,(),,,,,,,(

iiiii

rrrrrrriirrii yxd

yxdLyxyxS

steradianmeterUnits

1:

2

Surface

Page 12: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Reflectance

• Bidirectional Reflectance Distribution Function (BRDF)

ir

i r

),(

),(),,,(

iii

rrrrriir dE

dLf

steradian

Units1

:

Li

Lr

Page 13: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Isotropic BRDFs

• Rotation along surface normal does not change reflectance

ir

d

),(

),(),,(),,(

dii

drrdririrrir dE

dLff

Li

Lr

Page 14: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Anisotropic BRDFs

• Surfaces with strongly oriented microgeometry elements

• Examples: – brushed metals,

– hair, fur, cloth, velvet

Source: Westin et.al 92

Page 15: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Properties of BRDFs

• Non-negativity

• Energy Conservation

• Reciprocity

),( allfor 1),(),,,( iirrrriir df

),,,(),,,( iirrrrriir ff

0),,,( rriirf

Page 16: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

How to compute reflected radiance?

• Continuous version

• Discrete version – n point light sources

iiiirir

iirirrr

dndLf

dEfL

)cos()( ),(

)(),()(

21

1

4

cos),(

),()(

j

sjj

n

jrijr

j

n

jrijrrr

df

EfL

),(

Page 17: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Outline

• Introduction

• Radiometry

• Reflectance

• Reflectance Models

Page 18: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

How do we obtain BRDFs?

• Measure

BRDF values

directly

• Analytic Reflectance Models– Physically-based models

• based on laws on physics

– Empirical models• “ad hoc” formulas that work

Source: Greg Ward

Page 19: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ideal Diffuse Reflectance

• Assume surface reflects equally in all directions.

• An ideal diffuse surface is, at the microscopic level, a very rough surface.– Example: chalk, clay, some paints

Surface

Page 20: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ideal Diffuse Reflectance

• BRDF value is constant

Surface

i

dB

dA

idAdB cos

ir

iir

iirirrr

Ef

dEf

dEfL

)(

)(),()(

n

Page 21: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

• Ideal diffuse reflectors reflect light according to Lambert's cosine law.

Ideal Diffuse Reflectance

Page 22: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ideal Diffuse Reflectance

• Single Point Light Source– kd: The diffuse reflection coefficient.

– n: Surface normal.

– l: Light direction.

2 4 )()(

dkL s

dr

ln

Surface

l

n

Page 23: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ideal Diffuse Reflectance – More Details

• If n and l are facing away from each other, n • l becomes negative.

• Using max( (n • l),0 ) makes sure that the result is zero.– From now on, we mean max() when we write •.

• Do not forget to normalize your vectors for the dot product!

Page 24: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ideal Specular Reflectance

• Reflection is only at mirror angle.– View dependent

– Microscopic surface elements are usually oriented in the same direction as the surface itself.

– Examples: mirrors, highly polished metals.

Surface

l

n

r

Page 25: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ideal Specular Reflectance

• Special case of Snell’s Law– The incoming ray, the surface normal, and the reflected

ray all lie in a common plane.

Surface

l l

n

rr

rl

rl

rrll

nn

nn

sinsin

Page 26: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Non-ideal Reflectors

• Snell’s law applies only to ideal mirror reflectors.

• Real materials tend to deviate significantly from ideal mirror reflectors.

• They are not ideal diffuse surfaces either …

Page 27: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Non-ideal Reflectors

• Simple Empirical Model:– We expect most of the reflected light to travel in the

direction of the ideal ray.

– However, because of microscopic surface variations we might expect some of the light to be reflected just slightly offset from the ideal reflected ray.

– As we move farther and farther, in the angular sense, from the reflected ray we expect to see less light reflected.

Page 28: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Phong Model

• How much light is reflected?– Depends on the angle between the ideal reflection

direction and the viewer direction .

Surface

l

nr

Camera

v

Page 29: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Phong Model

• Parameters– ks: specular reflection coefficient

– q : specular reflection exponent

Surface

l

nr

Camera

v

22 4

)(

4

)(cos)(

dk

dkL sq

ssq

sr

rv

Page 30: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Phong Model

• Effect of the q coefficient

Page 31: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Phong Model

Surface

l

n

r

r

lnlnr

nlr

)(2

cos 2

2

2

4

))(

4

)()(

dk

dkL

sqs

sqsr

lnlnv

rv

)(2(

Page 32: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Blinn-Torrance Variation

• Uses the halfway vector h between l and v.

Surface

l

n

Camera

v

||vl||

vlh

h

22 4

)(

4

)(cos)(

dk

dkL sq

ssq

sr

hn

Page 33: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Phong Examples

• The following spheres illustrate specular reflections as the direction of the light source and the coefficient of shininess is varied.

Phong Blinn-Torrance

Page 34: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Phong Model

• Sum of three components:diffuse reflection +

specular reflection +

“ambient”.

Surface

Page 35: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Ambient Illumination

• Represents the reflection of all indirect illumination.

• This is a total hack!

• Avoids the complexity of global illumination.

ar kL )(

Page 36: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Putting it all together

• Phong Illumination Model

2 4

)()()( )(

dkkkL sq

sdar

rvln

Page 37: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

For Assignment 3

• Variation on Phong Illumination Model

iq

sdadr LkkLkL )( )()()( rvln

Page 38: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Adding color

• Diffuse coefficients:– kd-red, kd-green, kd-blue

• Specular coefficients:– ks-red, ks-green, ks-blue

• Specular exponent:q

Page 39: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Phong Demo

Page 40: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Fresnel Reflection

• Increasing specularity near grazing angles.

Source: Lafortune et al. 97

Page 41: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Off-specular & Retro-reflection

• Off-specular reflection– Peak is not centered at the reflection direction

• Retro-reflection:– Reflection in the direction of incident illumination

– Examples: Moon, road markings

Page 42: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

The Phong Model

• Is it non-negative?

• Is it energy-conserving?

• Is it reciprocal?

• Is it isotropic?

Page 43: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Shaders (Material class)

• Functions executed when light interacts with a surface

• Constructor:– set shader parameters

• Inputs:– Incident radiance

– Incident & reflected light directions

– surface tangent (anisotropic shaders only)

• Output:– Reflected radiance

Page 44: MIT EECS 6.837, Durand and Cutler Local Illumination

MIT EECS 6.837, Durand and Cutler

Questions?