Top Banner
Lighting Concepts
17

CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Jul 07, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Lighting Concepts

Page 2: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

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

Page 3: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Today

• Shading and lighting

• Chrome Dev tools

Page 4: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

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

Page 5: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

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]

Page 6: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

What if there is no light at all?

Page 7: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Let there be light

Page 8: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

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

Page 9: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Surface reflection

Page 10: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Diffuse reflection

• Diffuse reflector scatters light

• Assume equally all directions

• Also called Lambertian surface

• Diffuse reflection coefficient kd

• Angle of incoming light still critical

Page 11: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Lambert’s law (It’s OK if you don’t understand)

Page 12: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Diffuse reflection

Page 13: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Specular Reflection

• Shiny surfaces have high specular coefficient

• Used to model specular highlights

• Do *not* get mirror effect (need other techniques)

Page 14: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17
Page 15: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Shading

• So far we know how to do illumination for each vertex, how about the faces?

Page 16: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

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 𝒓 = 𝟐𝒏 𝒏 ∙ 𝒍 − 𝒍

Page 17: CS112 discussion session Week 5 - University of …graphics.ics.uci.edu/CS112/CS112_discussion_week5.pdfCS112 discussion session Week 5 Author Jia Chen Created Date 10/27/2018 8:20:17

Summary: Lighting Equations

• Blinn-Phong model: 𝐿 = 𝐿𝑎 + 𝐿𝑑 + 𝐿𝑠