Lights in the Phong Model
description
Transcript of Lights in the Phong Model
Lights in the Phong Model
𝐼=𝑘𝑎 𝐿𝑎+𝑘𝑑𝐿𝑑 ( �̂� ∙ �̂� )+𝑘𝑠𝐿𝑠 (𝑉 ∙ �̂� )𝑛
2. What are these?
�̂��̂� �̂�
1. How to compute these?
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
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
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
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
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/
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
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/
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
− �̂�θ
Rendered image
Maya Scene
Cone boundaries
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]𝑝
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
scene
No drop off
Penumbra region
Implement Penumbra Region
• For a visible position:
• cos(
If (cos( > cos( // < Full illumination
else if (cos() < cos()) // > no illuminationelse Penumbra region
θ𝝋− �̂�
𝛂𝑃 𝐿
A visibleposition
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
How about ?
• Let user specify each of thecomponents!
Maya:
OpenGL:
Our ToyRayTracer:
General form of Phone
𝐼= ∑𝑖
𝐴𝑙𝑙 h𝐿𝑖𝑔 𝑡𝑠
𝑘𝑎𝐿𝑎𝑖+𝐿𝑑 𝑖
𝐶0❑+𝐶1
❑𝑑+𝐶2❑𝑑2+𝐶3
❑𝑑3𝑘𝑑
( �̂� ∙𝐿𝑖)+𝐿𝑠𝑖
𝐶0❑+𝐶1
❑𝑑+𝐶2❑𝑑2+𝐶3
❑𝑑3𝑘𝑠 (𝑉 ∙𝑅𝑖 )
𝑛
Our Ray Tracer implements:
𝐼=𝑘𝑎+ ∑𝑖
𝐴𝑙𝑙 h𝐿𝑖𝑔 𝑡𝑠
𝐿𝑑𝑖 [𝑘𝑑 ( �̂� ∙𝐿𝑖)+𝑘𝑠 (𝑉 ∙𝑅𝑖 )𝑛 ]