Download presentation

Presentation is loading. Please wait.

Published byBeatriz Medland Modified about 1 year ago

1
1 Graphics CSCI 343, Fall 2013 Lecture 18 Lighting and Shading

2
2 Dealing with Lighting Light may come from one or more sources and interacts with objects in the scene, sometimes in complex ways. We would like to develop a model for lighting and shading that can look natural, but be computed rapidly. We use a local model, in which we base calculations on: 1) Material properties of objects in the scene 2) Local Geometry of the surfaces 3) Locations and properties of light sources.

3
3 Light that Reaches the Viewer Light reaches the viewer either: 1) Directly from the light source 2) After being reflected off an object 3) After being reflected off multiple objects We consider only those light rays that reach the viewer (through the center of projection, or COP) after passing through the clipping volume.

4
4 Surface appearance The interaction of light with a surface determines whether the surface appears light or dark, dull or shiny. It also determines the color of the surface. When light hits a surface: Some is absorbed Some is reflected Some passes through (for translucent surfaces). R R t

5
5 Surface color and texture If a surface absorbs all frequencies except red, and reflects red light, it will appear red. Shiny objects have smooth surfaces and the reflection is in a small range of directions that closely resemble the angle of reflection of a mirror. Dull objects have rough surfaces that reflect light in all directions.

6
6 Types of Surfaces Specular surfaces reflect light in a narrow range of directions (close to the reflection angle of a mirror). Mirrors are perfectly specular. Diffuse surfaces scatter light in all directions. Example: flat wall paint. Also called matte surfaces. Translucent surfaces allow some light to pass through the surface. The light may come out at a different angle than it entered (due to refraction). specular diffuse translucent

7
7 Light Sources z x y I A real light source is an object with a surface. Each point on the surface emits light in a given direction and with a given intensity for each wavelength: I(x, y, z, ) To find the total light from the source, we must integrate over the entire surface. To simplify the process, we model light with 4 types of sources: 1)Ambient 2) Point source 3) Spot Light 4) Distant light Each light source emits different wavelengths with different intensities. We will model this as a function of red, green and blue wavelengths.

8
8 Ambient Light Ambient light is diffuse light that is about the same intensity everywhere. The light sources are distributed to provide uniform illumination. We model ambient light by I a, which has a uniform intensity at every point in the scene. As with all our light sources I a has red, green, and blue components:

9
9 Point Sources Point sources of light emit light equally in all directions. The intensity diminishes with the square of the distance from the source. To soften the edges of objects, use: where p p0p0

10
10 Spot Lights Spot lights are point sources that have a limited range of emitted light. Usually the intensity decreases with the distance of the light ray from the center of this range. IsIs psps I I = ? The exponent, e, determines how rapidly the function falls off. Larger values of e imply a faster drop off (i.e. a narrower spotlight). I = cos e

11
11 Distant Light sources For light sources that are very far away, all the light hits the surface at approximately the same angle. We model the light rays as parallel, and perform calculations based on the direction of the light source (as opposed to the location of the light source).

12
12 The Phong Reflection Model The Phong reflection model leads to efficient computation of surface lighting and gives reasonably realistic renderings. It uses 4 vectors to calculate the color and intensity of a point on a surface. n = normal to the surface at p l = direction to light source v = direction to viewer (COP) r = direction of perfectly reflected ray (determined by n and l) p l n v r

13
13 Modeling light intensity In the Phong reflection model, we model the light intensity of reflected light at each point as the sum of ambient light, diffuse light, and specular reflection at that point: I = I a + I d + I s = L a R a + L d R d + L s R s We model the light source as having 3 components: L a, L d, L s The surface reflects these components by different amounts: R a, R d, R s We will consider each of the components separately.

14
14 Ambient Reflection The intensity of ambient light is the same at every point on the surface: L a The amount of light reflected is given by the reflection coefficient of the surface: R a = k a, where 0<=k a <=1 I a = k a L a

15
15 Diffuse Reflection A perfectly diffuse reflector scatters light equally in all directions. This is known as a Lambertian surface. Generally these are rough surfaces. The amount of light is determined by Lambert's law. where is the angle between the normal to the surface (n) and the direction to the light source (l). BrighterDimmer n l If n and l are normalized to length one, then: Why?

16
16 Diffuse reflection continued Not all the light that hits a surface at a point is reflected. The amount of reflected light is determined by the reflection coefficient, k d. Finally, we can include an attenuation term to account for the distance, d, of the surface from the light source:

17
17 Specular Reflection Specular reflection provides highlights on the object. The angle of reflection = the angle of incidence i = r The amount of light seen by the viewer depends on the difference between the angle of r and the angle of the viewer, v. We will call this angle . l n r v is the shininess coefficient. Higher values make the surface shinier. = infinity is a mirror. 100 < < 500 is metallic. ii rr

18
18 The complete Phong reflection model Putting all the terms together gives the full Phong reflection model:

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google