CS112 discussion session Week 5 - University of...
Transcript of CS112 discussion session Week 5 - University of...
Correction on programming assignment 2
• The correct values:
• K_a = 0.1, K_d = 0.8, K_s =0.4.
• The document wrote K_a = 0.1, K_d = 0.4, K_s =0.4
Shading
• Human vision uses shading as a cue to form, position and depth
• Total handling of light is very time-consuming → physically based rendering
• Shading model gives us a good and fast approximation of what would “really” happen, much less expensive
Common types of light sources
• Ambient light: no identifiable source or direction
• Point source: given only by point
• Distant light (directional light): given only by direction
• Spotlight: from source in direction• Cut-off angle defines a cone of light
• Attenuation function (brighter in center)
• Light source described by a luminance• Each color is described separately
• I = [Ir Ig Ib]
Ambient light
• Not a physically meaningful quantity, just to make the scene not too dark even if no light reaches a point.
• Intensity is the same at all points
• This light is the same in all directions.
• I = Iaka
• Ia = intensity of ambient light
• ka = percentage of the light reflected by the object• Coefficient of ambient reflection
Diffuse reflection
• Diffuse reflector scatters light
• Assume equally all directions
• Also called Lambertian surface
• Diffuse reflection coefficient kd
• Angle of incoming light still critical
Specular Reflection
• Shiny surfaces have high specular coefficient
• Used to model specular highlights
• Do *not* get mirror effect (need other techniques)
Summary: Lighting Equations
• Ambient Term• depend on nothing (environment light)• 𝐿𝑎 = 𝐾𝑎 ∗ 𝐼𝑎 where 𝐾𝑎 is ambient coefficient
• Diffuse Term• depend only on the light direction (Lambert’s law)• 𝐿𝑑 = 𝐾𝑑 ∗ 𝐼𝑑 ∗ max(𝒏 ∙ 𝒍, 0)
where 𝐾𝑑 is diffuse coefficient, 𝒍 is light direction and 𝒏 is surface normal• Attenuation is not required for the assignment
• Specular Term• depend on light direction 𝒍 and view direction 𝒗• 𝐿𝑠 = 𝐾𝑠 ∗ 𝐼𝑠 ∗ max 𝒗 ∙ 𝒓, 0 𝑛
where 𝒓 is the mirror of 𝒍 about the surface normal 𝒓 = 𝟐𝒏 𝒏 ∙ 𝒍 − 𝒍