Illumination and Shading - PowerPoint PPT Presentation

About This Presentation
Title:

Illumination and Shading

Description:

Specular light ... the amount of specular light is determined by the smoothness of an object. specular light causes a 'hot spot' on shiny objects. The 'hot spot' ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 39
Provided by: sch56
Category:

less

Transcript and Presenter's Notes

Title: Illumination and Shading


1
Illumination and Shading
2
Illumination (Lighting)
  • Model the interaction of light with surface
    points to determine their final color and
    brightness
  • OpenGL computes illumination at vertices

illumination
3
Shading
  • Apply the lighting model at a set of points
    across the entire surface

Shading
4
Illumination Model
  • The governing principles for computing the
    illumination
  • A illumination model usually considers
  • Light attributes (light intensity, color,
    position, direction, shape)
  • Object surface attributes (color, reflectivity,
    transparency, etc)
  • Interaction among lights and objects (object
    orientation)
  • Interaction between objects and eye (viewing dir.)

5
Illumination Model
  • a set of mathematical equations that calculate
    the color of each pixel that represents an
    object.
  • Tradeoffs must be made between the speed of the
    rendering and the quality of the rendering.
  • In general, as the accurately of the model
    approaches real world lighting effects, the
    better the graphics but the slower the rendering.

6
Illumination Model
7
Illumination Calculation
  • Local illumination only consider the light, the
    observer position, and the object material
    properties
  • Example OpenGL

8
Illumination Models
  • Global illumination take into account the
    interaction of light from all the surfaces in the
    scene

9
Light and object interaction
  • When light strikes an object it is
  • 1) absorbed and converted to heat,
  • 2) reflected off the surface, or
  • 3) refracted (bent) and passed through (e.g.,
    water, glass, cellophane)

10
Light and object interaction
  • For an accurate lighting model, all three
    interactions must be accounted for, but we will
    concentrate on reflected light. Reflected light
    is the light that has bounced off of an object
    into our eye (or camera). Reflected light is the
    light we actually see.

11
Reflected Light
  • The model used by OpenGL consider three types
    of light contribution to compute the final
    illumination of an object
  • Ambient
  • Diffuse
  • Specular
  • Final illumination of a point (vertex)
  • ambient diffuse specular

12
Ambient lighting example
13
Diffuse lighting example
14
Specular light example
15
Ambient light
  • general light in a room background light.
  • light that has been scattered in so many
    directions that it's source cannot be determined
    (ambient light has no direction).
  • ambient light determines the color of the portion
    of an object not in direct light. This is
    sometimes referred to as an object's "back side.
  • the relative position of the object, camera, and
    light sources has no effect on ambient light.

16
Ambient lighting example
17
Ambient light calculation
  • Each light source has an ambient light
    contribution (Ia)
  • Different objects can reflect different amounts
    of ambient (different ambient reflection
    coefficient Ka,
  • 0 lt Ka lt 1)
  • So the amount of ambient light that can be seen
    from an object is
  • Ambient Ia x Ka

18
Diffuse light
  • light that comes from one specific direction
    scatters in all directions
  • a surface is brighter (scatters more light) if it
    is perpendicular to the light direction
  • diffuse light is what gives an object its
    predominate color and what makes an object look
    "curved" or "rounded."
  • the relative position of the object to the light
    sources determines diffuse lighting.

19
Diffuse light contribution
  • Diffuse light The illumination that a surface
    receives from a light source and reflects equally
    in all direction

It does not matter where the eye is
20
Diffuse lighting example
21
Diffuse light calculation
  • Need to decide how much light the object point
    receive from the light source based on
    Lamberts Law

Receive less light
Receive more light
22
Diffuse light calculation (2)
  • Lamberts law the radiant energy D that a small
    surface patch receives from a light source is
  • D I x cos (q)
  • I light intensity
  • q angle between the light vector and the
    surface normal

light vector (vector from object to light)
q
N surface normal
23
Diffuse light calculation (3)
  • Like the ambient light case, different objects
    can reflect different amount of diffuse light
    (different diffuse reflection coefficient Kd, 0
    lt Kd lt 1))
  • So, the amount of diffuse light that can be seen
    is
  • Diffuse Kd x I x cos (q)

cos(q) N.L
24
Specular light
  • light that comes from one specific direction and
    bounces off in one specific direction.
  • the amount of specular light is determined by the
    smoothness of an object
  • specular light causes a "hot spot" on shiny
    objects. The "hot spot" moves as the observer
    moves.
  • the relative position of the object, camera, and
    light sources determine the amount of specular
    lighting.

25
Specular light contribution
  • The bright spot on the object
  • The result of total reflection of
  • the incident light in a concentrate
  • region

See nothing!
26
Specular light example
27
Specular light calculation
  • How much reflection you can see depends on where
    you are

The only position the eye can see specular from P
if the object has an ideal reflection surface
But for a non-perfect surface you will still see
specular highlight when you move a little bit
away from the idea reflection direction When f
is small, you see more specular highlight
28
Specular light calculation (2)
  • Phong lighting model
  • specular Ks x I x cos(f)
  • Ks specular reflection coefficient
  • N surface normal at P
  • I light intensity
  • f angle between V and R
  • cos(f) the larger is n, the smaller
  • is the cos value
  • cos(q) R.V

n
n
29
Specular light calculation (3)
  • The effect of n in the phong model

n 10
n 90
n 30
n 270
30
Put it all together
  • Illumination from a light
  • Illum ambient diffuse specular
  • Ka x I Kd x I x (N.L) Ks x
    I x (R.V)
  • If there are N lights
  • Total illumination for a point P S
    (Illum)

n
31
Summary of reflected light
n
32
Equations
A. Notation Let P be the point on the object
being rendered. m be the surface normal vector
of the object at P. v be the vector from P to
the eye (or camera). s be the vector from P to
the light source.
33
Equations
B. Calculating diffuse light Lambert's law the
amount of light reflected by a surface is
proportional to the cos of the angle between the
surface orientation (surface normal) and the
location of the light source.
34
Equations
The percentage of diffuse light can be calculated
by taking the dot product of s and m (and
dividing by their lengths if they are not unit
vectors.) Diffuse light percentage sm /
sm The cos curve goes negative if the angle
between the two vectors is not in the range -90
to 90. Outside this range, the light does not
strike the front surface of the object. Therefore
we must make sure that if the angle is outside
this range the calculation generates a zero
percent reflection. Diffuse light percentage
max sm / sm, 0
35
Equations
C. Calculating specular light Specular light is
reflected off of an object directly into the
camera. (It is typically white because the light
is white. If the light was pure blue, the
specular highlights would be pure blue. The
specular highlights are the color of the light
source and not the color of the
object.) Specular light is some percentage of
the light source's light based on the light
reflection off of the object into the camera.
36
Equations
Light
Camera
v
s
m
Reflection of light ray
P
r
Object
this angle determines the percentage of specular
light
The amount of the reflected light that reaches
the camera is proportional to the cos of the
angle between the light reflection vector (r) and
the vector from P to the camera (v).
37
Equations

The percentage of specular light can be
calculated by taking the dot product of r and v
(and dividing by their lengths if they are not
unit vectors.) specular light percentage rv /
rv
38
Equations

The cos curve goes negative if the angle between
the two vectors is not in the range -90 to 90.
Therefore we must make sure that if the angle is
outside this range the calculation generates a
zero percent specular reflection. Specular
light percentage max rv / rv, 0
Write a Comment
User Comments (0)
About PowerShow.com