Download - Lights in the Phong Model

Transcript
Page 1: Lights in the  Phong  Model

Lights in the Phong Model

๐ผ=๐‘˜๐‘Ž ๐ฟ๐‘Ž+๐‘˜๐‘‘๐ฟ๐‘‘ ( ๏ฟฝฬ‚๏ฟฝ โˆ™ ๏ฟฝฬ‚๏ฟฝ )+๐‘˜๐‘ ๐ฟ๐‘  (๐‘‰ โˆ™ ๏ฟฝฬ‚๏ฟฝ )๐‘›

2. What are these?

๏ฟฝฬ‚๏ฟฝ๏ฟฝฬ‚๏ฟฝ ๏ฟฝฬ‚๏ฟฝ

1. How to compute these?

Page 2: Lights in the  Phong  Model

Light source direction: โ€ข Look around you โ€ฆ โ€ข The light in Seattle: Indirectโ€“ background, โ€ฆ ambient

โ€ข Sun light: Direct, very far awayโ€“ coming from a constant direction

(independent of where you are)โ€ข Light bulb at home: Directโ€“ closer, shines from a fixed point

โ€ข Light from the projector/desk lampโ€“ How would you describe this?

credit: http://mynasadata.larc.nasa.gov/Radiation_Explanation.html

credit: http://www.truebeyonddesign.com/products-page/

http://www.apartmenttherapy.com/ny/lighting/best-product-tolomeo-desk-lamp-001066

Page 3: Lights in the  Phong  Model

What is Ambient Light?

โ€ข Not in the real world!โ€ข Implementation dependent!โ€“ constant color added to illumination resultsโ€“ Maya scene file

Ambient lightMaterial Property

Rendered image

Page 4: Lights in the  Phong  Model

What about the Sun?

โ€ข How would you describe the incoming light source for this scene?

http://www.planetware.com/picture/kansas-cottonwood-falls-tallgrass-prairie-national-preserve-flint-hills-national-prairie-us-ks108.htm

Page 5: Lights in the  Phong  Model

Directional Lightโ€ข Direction is: โ€ข No position!! (where is the Sun?)โ€ข Light has no geometry and does not show up

in final rendered imageโ€ข Planes looks โ€ฆ flat โ€ข Maya Scene

โˆ’ ๏ฟฝฬ‚๏ฟฝ

Directional Light

Rendered image

Page 6: Lights in the  Phong  Model

What about the Light Bulb?

โ€ข How would you describe the light source of these scenes?

http://home.cogeco.ca/~richardastro2/

http://companyofburninghearts.wordpress.com/2010/03/18/mystic-clusters/

Page 7: Lights in the  Phong  Model

Point Lightโ€ข Position ()โ€ข For every visible position ()

โ€ข is unique!

โ€ข Illumination is a function of relative position to lights!

โ€ข Maya Scene

Different vector for each visible point

Rendered imagePoint Lights

Page 8: Lights in the  Phong  Model

Now, my desk lamp

http://0.tqn.com/d/drawsketch/1/0/N/J/eggsetup.jpg

http://www.mackayphotography.co.uk/light_pollution.htm

โ€ข How would you describe the light source of these scenes?

http://agreenliving.org/tag/concept-design/

http://www.how-to-refinish-hardwood-floors.wirze.com/

Page 9: Lights in the  Phong  Model

Spot Lightโ€ข Direction + Position:โ€“ Pointing direction

โ€“ As in point light, for each visible point is unique!

โ€“ Cone angle (ฮธ) defines illumination range

๐‘ƒ ๐ฟ

Different vector for each visible point

โˆ’ ๏ฟฝฬ‚๏ฟฝฮธ

Page 10: Lights in the  Phong  Model

Rendered image

Maya Scene

Cone boundaries

Page 11: Lights in the  Phong  Model

Spotlight boundsโ€“ Position: โ€“ Main directionโ€“ : cone angleโ€“ ฮธ: regions of full

illumination โ€“ angle to position

for illuminationโ€“ If ฮธ< < Illumination drops off according to:

ฮธ๐‹โˆ’ ๏ฟฝฬ‚๏ฟฝ

๐‘ƒ ๐ฟ

Region: fully illuminated

Penumbra Region: gradual drop off

๐›‚ Illumination at this point is

๐ผ ๐‘“=[ cos๐›ผโˆ’ cos ๐œ‘2cos ๐œƒ2โˆ’ cos ๐œ‘

2]๐‘

Page 12: Lights in the  Phong  Model

Drop off behavior

๐ผ ๐‘“=[ cos๐›ผโˆ’ cos ๐œ‘2cos ๐œƒ2โˆ’ cos ๐œ‘

2]๐‘

Drop off p=1

p=0.2

p=0.1

p=30p=20

P>1

P<1

Page 13: Lights in the  Phong  Model

scene

No drop off

Penumbra region

Page 14: Lights in the  Phong  Model

Implement Penumbra Region

โ€ข For a visible position:

โ€ข cos(

If (cos( > cos( // < Full illumination

else if (cos() < cos()) // > no illuminationelse Penumbra region

ฮธ๐‹โˆ’ ๏ฟฝฬ‚๏ฟฝ

๐›‚๐‘ƒ ๐ฟ

A visibleposition

Page 15: Lights in the  Phong  Model

Distance Attenuationโ€ข Illumination is a function of

โ€ข d = distance between light and visible position!!

โ€ข Physics tells us โ€ข Did not follow physics in the rest of the

model!โ€“ WAY too dark!!

โ€ข Generally:

d

๐ผ=๐ผ๐ฟ

๐ถ0โ‘+๐ถ1

โ‘๐‘‘+๐ถ2โ‘๐‘‘2+๐ถ3

โ‘๐‘‘3

Page 16: Lights in the  Phong  Model

How about ?

โ€ข Let user specify each of thecomponents!

Maya:

OpenGL:

Our ToyRayTracer:

Page 17: Lights in the  Phong  Model

General form of Phone

๐ผ= โˆ‘๐‘–

๐ด๐‘™๐‘™ h๐ฟ๐‘–๐‘” ๐‘ก๐‘ 

๐‘˜๐‘Ž๐ฟ๐‘Ž๐‘–+๐ฟ๐‘‘ ๐‘–

๐ถ0โ‘+๐ถ1

โ‘๐‘‘+๐ถ2โ‘๐‘‘2+๐ถ3

โ‘๐‘‘3๐‘˜๐‘‘

( ๏ฟฝฬ‚๏ฟฝ โˆ™๐ฟ๐‘–)+๐ฟ๐‘ ๐‘–

๐ถ0โ‘+๐ถ1

โ‘๐‘‘+๐ถ2โ‘๐‘‘2+๐ถ3

โ‘๐‘‘3๐‘˜๐‘  (๐‘‰ โˆ™๐‘…๐‘– )

๐‘›

Our Ray Tracer implements:

๐ผ=๐‘˜๐‘Ž+ โˆ‘๐‘–

๐ด๐‘™๐‘™ h๐ฟ๐‘–๐‘” ๐‘ก๐‘ 

๐ฟ๐‘‘๐‘– [๐‘˜๐‘‘ ( ๏ฟฝฬ‚๏ฟฝ โˆ™๐ฟ๐‘–)+๐‘˜๐‘  (๐‘‰ โˆ™๐‘…๐‘– )๐‘› ]