Lights in the Phong Model
description
Transcript of Lights in the Phong Model
![Page 1: Lights in the Phong Model](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/1.jpg)
Lights in the Phong Model
𝐼=𝑘𝑎 𝐿𝑎+𝑘𝑑𝐿𝑑 ( �̂� ∙ �̂� )+𝑘𝑠𝐿𝑠 (𝑉 ∙ �̂� )𝑛
2. What are these?
�̂��̂� �̂�
1. How to compute these?
![Page 2: Lights in the Phong Model](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/2.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/3.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/4.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/5.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/6.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/7.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/8.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/9.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/10.jpg)
Rendered image
Maya Scene
Cone boundaries
![Page 11: Lights in the Phong Model](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/11.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/12.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/13.jpg)
scene
No drop off
Penumbra region
![Page 14: Lights in the Phong Model](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/14.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/15.jpg)
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](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/16.jpg)
How about ?
• Let user specify each of thecomponents!
Maya:
OpenGL:
Our ToyRayTracer:
![Page 17: Lights in the Phong Model](https://reader036.fdocuments.us/reader036/viewer/2022062323/5681610d550346895dd0632b/html5/thumbnails/17.jpg)
General form of Phong
𝐼= ∑𝑖
𝐴𝑙𝑙 h𝐿𝑖𝑔 𝑡𝑠
𝑘𝑎𝐿𝑎𝑖+𝐿𝑑𝑖
𝐶0❑+𝐶1
❑𝑑+𝐶2❑𝑑2+𝐶3
❑𝑑3𝑘𝑑
( �̂� ∙𝐿𝑖)+𝐿𝑠𝑖
𝐶0❑+𝐶1
❑𝑑+𝐶2❑𝑑2+𝐶3
❑𝑑3𝑘𝑠 (𝑉 ∙𝑅𝑖 )
𝑛
Our Ray Tracer implements:
𝐼=𝑘𝑎+ ∑𝑖
𝐴𝑙𝑙 h𝐿𝑖𝑔 𝑡𝑠
𝐿𝑑𝑖 [𝑘𝑑 ( �̂� ∙𝐿𝑖)+𝑘𝑠 (𝑉 ∙𝑅𝑖 )𝑛 ]