Download presentation
Presentation is loading. Please wait.
1
Lights in the Phong Model
𝑹 𝑵 𝑳 1. How to compute these? 𝐼= 𝑘 𝑎 𝐿 𝑎 + 𝑘 𝑑 𝐿 𝑑 𝑁 ∙ 𝐿 + 𝑘 𝑠 𝐿 𝑠 𝑉 ∙ 𝑅 𝑛 2. What are these?
2
Light source direction: 𝐿
credit: 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:
3
What is Ambient Light? Not in the real world!
Implementation dependent! constant color added to illumination results Maya scene file Ambient light Material Property Rendered image
4
What about the Sun? How would you describe the incoming light source for this scene?
5
Directional Light Direction is: − 𝐿 No position!! (where is the Sun?)
− 𝑳 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 Rendered image Directional Light
6
What about the Light Bulb?
How would you describe the light source of these scenes?
7
Point Light Position ( 𝑃 𝐿 ) For every visible position ( 𝑃 𝑖 )
Different 𝐿 𝑖 vector for each visible point Position ( 𝑃 𝐿 ) For every visible position ( 𝑃 𝑖 ) 𝐿 𝑖 = 𝑃 𝐿 − 𝑃 𝑖 is unique! Illumination is a function of relative position to lights! Maya Scene Point Lights Rendered image
8
Now, my desk lamp How would you describe the light source of these scenes?
9
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 − 𝐿 θ
10
Rendered image Cone boundaries Maya Scene
11
Spotlight bounds Position: 𝑃 𝐿 Main direction:− 𝑳 𝝋: cone angle
θ 𝝋 − 𝑳 𝑃 𝐿 Region: fully illuminated Penumbra Region: gradual drop off 𝛂 Illumination at this point is 𝐼 𝑓 Position: 𝑃 𝐿 Main direction:− 𝑳 𝝋: cone angle θ: regions of full illumination 𝛂: angle to position for illumination If θ< 𝛂 < 𝝋 Illumination drops off according to: 𝐼 𝑓 = cos 𝛼 − cos 𝜑 2 cos 𝜃 2 − cos 𝜑 𝑝
12
Drop off behavior 𝐼 𝑓 = cos 𝛼 − cos 𝜑 2 cos 𝜃 2 − cos 𝜑 2 𝑝 P<1
Drop off p=1 p=20 p=30
13
No drop off Penumbra region scene
14
Implement Penumbra Region
θ 𝝋 − 𝑳 𝛂 𝑃 𝐿 A visible position 𝑃 𝑖 For a visible position: 𝑃 𝑖 𝐿 𝑖 = 𝑛𝑜𝑟𝑚𝑎𝑙𝑖𝑧𝑒(𝑃 𝐿 − 𝑃 𝑖 ) cos(𝛼)= 𝐿 𝑖 ∙ 𝐿 If (cos(𝛼) > cos( 𝜃 2 )) // 𝛼 < 𝜃 Full illumination else if (cos(𝛼) < cos( 𝜑 2 )) // 𝛼 > 𝜑 no illumination else Penumbra region
15
Distance Attenuation Illumination is a function of
d = distance between light and visible position!! Physics tells us 𝐼∝ 1 𝑑 2 Did not follow physics in the rest of the model! WAY too dark!! Generally: 𝐼= 𝐼 𝐿 𝐶 0 + 𝐶 1 𝑑+ 𝐶 2 𝑑 2 + 𝐶 3 𝑑 3
16
How about 𝐼 𝐿 ? Let user specify each of the components! OpenGL: Maya:
Our ToyRayTracer:
17
General form of Phong 𝐼= 𝑖 𝐴𝑙𝑙 𝐿𝑖𝑔ℎ𝑡𝑠 𝑘 𝑎 𝐿 𝑎𝑖 + 𝐿 𝑑𝑖 𝐶 0 + 𝐶 1 𝑑+ 𝐶 2 𝑑 2 + 𝐶 3 𝑑 3 𝑘 𝑑 𝑁 ∙ 𝐿 𝑖 + 𝐿 𝑠𝑖 𝐶 0 + 𝐶 1 𝑑+ 𝐶 2 𝑑 2 + 𝐶 3 𝑑 3 𝑘 𝑠 𝑉 ∙ 𝑅 𝑖 𝑛 Our Ray Tracer implements: 𝐼= 𝑘 𝑎 + 𝑖 𝐴𝑙𝑙 𝐿𝑖𝑔ℎ𝑡𝑠 𝐿 𝑑𝑖 𝑘 𝑑 𝑁 ∙ 𝐿 𝑖 + 𝑘 𝑠 𝑉 ∙ 𝑅 𝑖 𝑛
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.