120 likes | 314 Views
Lighting Models. Soon Tee Teoh CS 116A. Terminology. Illumination Model (or Lighting Model, or Shading Model): Calculate the color of an illuminated point on the surface of an object
E N D
Lighting Models Soon Tee Teoh CS 116A
Terminology • Illumination Model (or Lighting Model, or Shading Model): Calculate the color of an illuminated point on the surface of an object • Surface-Rendering Method: Use the color calculations from an illumination model to determine color of all pixels in the scene
Light Sources • Point light source – Rays emanate from a point • Infinitely Distant Light source – Rays are parallel
Attenuation • Attenuate means “to weaken”. • Light loses energy as it travels further. • In general, amplitude of light at distance d from the light source is 1/d2 of its amplitude at the source. • However, to allow user more control over the attenuation, we let the attenuation be 1/(a0+a1d+a2d2), where the user can choose the coefficients a0, a1 and a2. • We assume that infinite light sources don’t attenuate.
Directional Spotlight • Light source with a specified position, direction, and angle limit q. source Vlight q
Test if a vertex is in the light cone • Suppose that the unit vector of the light direction is Vlight, and the unit vector from the light source to a point is Vobj. • Let the angle between Vlight and Vobj be a. • The point is within the cone (and therefore illuminated by this spotlight) if a < q. • But, • Vobj.Vlight = cos a • Assume that 0o < q < 90o, then the point must be within the cone if cos a > cos q. • Therefore, calculate cos q once, and then for each object, just compare Vobj.Vlight with cos q to figure out if it’s illuminated by the light. Vobj point a source Vlight q
Angular Attenuation • We can also attenuate light as it deviates from the principal direction. • Commonly used angular attenuation factor is: cosa f, where 0o < f < q. • The user can choose the value a, as long as it is positive. f is measured as the angle from the principal light direction. • For a large value of a, the light attenuates quickly as it deviates from the principal direction.
Surface Lighting Effects • How is a surface illuminated? • We consider three ways: • Diffuse reflection: Rough, matte surface – surface appears equally bright from any viewing angle • Specular reflection: Shiny surface, reflected light is highlighted at a bright spot • Ambient light: background light illuminates surface not directly exposed to any light source
Ambient Lighting Model • In this model, we simply set a uniform, global “ambient” light that will light up any surface. • The ambient reflection off a surface is independent of its position and orientation.
Diffuse Reflection • The ideal diffuse reflector (or Lambertian reflector): Incident light is reflected with equal intensity in all directions, regardless of viewing position. • How much light is reflected depends on the “reflectiveness” of the surface. A highly reflective surface reflects most of the light. • Let the “reflectiveness” parameter be k. • Then the ambient reflection is Iref = kIamb, where Iref is the intensity of light reflected, and Iamb is the intensity of ambient light.
Diffuse Reflection • Ambient light alone produces uninteresting flat shading. • Diffuse reflection from directional light is dependent on the relative direction of the light. • Idea: A surface that is perpendicular to the direction of the incident
Diffuse Reflection • The angle between the incoming light and the surface normal is called the angle of incidence q. • The projected area of the surface perpendicular to the light direction is proportional to cos q. • Therefore the amount of incident light falling on a surface from a light source of intensity Isource is: Ifalling = Isource cos q • Therefore diffuse reflection from this light source is Ireflected = kIfalling = kIsource cos q N q Incident light A cos q A q