Lighting, Shading Models - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Lighting, Shading Models

Description:

Specular Refraction (Snell's law) Specular Refraction. Path shifts are ... From Snell's law, we can obtain the unit transmission vector T in the direction ... – PowerPoint PPT presentation

Number of Views:91
Avg rating:3.0/5.0
Slides: 29
Provided by: elrhalibi2
Category:

less

Transcript and Presenter's Notes

Title: Lighting, Shading Models


1
Lighting, ShadingModels
Abdennour El Rhalibi
2
Illumination Models
  • Discuss how to shade surfaces based on position,
    orientation, and characteristics of the surfaces
    and the light sources illuminating them
  • Light components
  • Illumination models

3
Definitions
  • Illumination
  • The transport of energy from a light source to a
    surface
  • Lighting
  • The process of computing the luminous intensity
    (i.e., outgoing light) at a particular 3D point,
    usually on a surface
  • Shading
  • Assigning colors to pixels

4
Classification of Lights
  • Lighting is divided into 4 independent
    components
  • Ambient light
  • Diffuse light
  • Specular light
  • Emissive light

5
Ambient Light (1/3)
  • Ambient illumination is light thats been
    scattered so much by the environment that its
    direction is impossible to determine it seems
    to come from all directions
  • Backlighting in a room has a large ambient
    component since most of the light reaching your
    eye has first bounced off many surfaces
  • A spotlight outdoors has a tiny ambient component
    since most of the light travels in the same
    direction

6
Ambient Light (2/3)
  • Illumination equation resulting intensity at
    each point on the object is
  • I Ia ?ka
  • Ia intensity of the ambient light (light
    property)
  • ka ambient-reflection coefficient, ranging
    between 0 and 1. (material property)

7
Ambient Light (3/3)
A sphere lit by a directional light
A sphere lit by an ambient light
  • Viewpoint not important
  • Light position not important
  • Surface angle not important

8
Diffuse Light
  • The diffuse component is the light that comes
    from one direction,
  • so its brighter if it comes squarely down on a
    surface than if it barely glances off the surface
  • Once it hits the surface, its scattered equally
    in all directions,
  • so it appears equally bright from all viewing
    positions

9
Lamberts Law
  • Brightness depends on the angle ? between the
    light direction and the surface normal

Illumination equation I Ip ? kd ? cos?
Ip point light intensity kd materials
diffuse-reflection coefficient
10
Light-Source Attenuation
  • Lambertian reflection does not take into account
    distance between light source and surface points
  • We introduce a light-source attenuation factor
    fatt
  • The energy from a point light source that reaches
    a given part of a surface falls off as the
    distance to this part lengthens.
  • c1, c2, c3 are user-defined constants associated
    with the light source

I fatt ? Ip ? kd ? cos?
11
Specular Light
  • Specular light comes from a particular direction
    and tends to bounce the surface in a preferred
    direction
  • A well-collimated laser beam bouncing off a
    mirror produces almost 100 specular reflection
  • Shiny surface has a high specular component
  • Chalk and carpet have almost no specular component

12
Phongs Law
I Is ? ks ? cosn?
  • Specular reflection depends on viewpoint max
    when ? 0 and falls off as ? increases
  • ks ? 0, 1 specular-reflection coefficient, a
    material property
  • n ? 1, 100s specular-reflection exponent, a
    material property

13
Putting It All Together
lights
  • Itotal kaIa ?fatt,jIj(kdcos?j kscosn?j)

j1
Ambient component
Diffuse component
Specular component
attenuation factor
  • Usually called Phong Lighting Model
  • What about colored light???

14
Shading Models
  • Surface shading
  • apply shading model to each point of curved
    surface
  • approximate curved surfaces by plane surfaces
    and then shade the plane surfaces
  • Constant shading, Gouraud shading, Phong shading

15
Constant Shading (Flat Shading)
  • infinitely distant light source (constant )
    result in constant diffuse reflection
  • constant and infinitely distant viewpoint
    (constant ) result in constant specular
    reflection
  • abrupt change in surface orientation of adjacent
    surfaces produce an unrealistic effect

16
Smooth shading
  • Two popular methods
  • Gouraud shading (used by OpenGL)
  • Phong shading (better specular highlight, not in
    OpenGL)

17
Normal vector of a vertex
18
Gouraud Shading
  • Compute vertex illumination (color) before the
    projection transformation
  • Shade interior pixels color interpolation
    (normals are not needed)

C1
for all scanlines
Ca lerp(C1, C2)
Cb lerp(C1, C3)
C3
C2
lerp linear interpolation
Lerp(Ca, Cb)
19
Gouraud Shading Problem
  • Lighting in the polygon interior can be inaccurate

20
Mach band effect
  • These Mach Bands are not physically there.
    Instead, they are illusions due to excitation and
    inhibition in our neural processing.

The bright bands at 45 degrees (and 135 degrees)
are illusory. The intensity of each square is the
same.
21
Mach band effect
Count the Black Dots. ?
22
Phong Shading
  • Surface normals are interpolated
  • Shades are computed at each point using the
    interpolated normal vector
  • The shading computed by Phong shading is C1
    continuous.
  • Fix the mach band effect remove edge
    discontinuity

23
Phong Shading
  • Normal interpolation
  • Slow not supported by OpenGL and most graphics
    hardware

24
Problems with Interpolated Shading
  • Polygon silhouette
  • Perspective distortion
  • Orientation dependence
  • Shared edges
  • Unrepresentative vertex
  • normals

25
Refractions (Transparent Surfaces)
  • ? diffuse refraction
  • partially transparent object (e.g. frosted glass)
    penetrating light is diffused
  • decrease light intensity, spread intensity
    contribution of each point onto a finite area on
    the refracting surface
  • expensive, seldom used

26
Specular Refraction (Snells law)
  • N
  • L R
  • T
  • , index of refraction of each material
  • (averaged over wavelengths)

27
Specular Refraction
  • Path shifts are ignored for thin objects
  • From Snells law, we can obtain the unit
    transmission vector T in the direction

28
Interpolated Transparency
transmission coefficient (0 for opaque
objects, 1 for totally transparent
objects)
2
1
line of sight
Write a Comment
User Comments (0)
About PowerShow.com