VIEWS: 51 PAGES: 6

• pg 1
```									 Illumination Models and Shading                              Illumination Models and Shading
Foley & Van Dam, Chapter 16
• Light Source Models
• Ambient Illumination
• Diffuse Reflection
• Specular Reflection
• Polygon Rendering Methods

Illumination Models                                Illumination Model Parameters
• Lighting effects are described with models that consider the
• Motivation: In order to produce realistic images,         interaction of light sources with object surfaces
we must simulate the appearance of surfaces under
various lighting conditions                                 • The factors determining the lighting effects are:
– The light source parameters:
• Positions
• Illumination Model: Given the illumination                       • Electromagnetic Spectrum
incident at a point on a surface, quantifies the                   • Shape
reflected light                                                – The surface parameters
• Position
• Reflectance properties
• Position of nearby surfaces
– The eye (camera) parameters
• Position
• Sensor spectrum sensitivities

Illumination Models and Rendering                                       Light Source Models
• An illumination model is used to calculate the            • Point Source (a): All light rays originate at a point and
intensity of the light that is reflected at a given point      radially diverge. A reasonable approximation for sources
whose dimensions are small compared to the object size
on a surface
• Parallel source (b): Light rays are all parallel. May be
• A rendering method uses intensity calculations              modeled as a point source at infinite distance (the sun)
from the illumination model to determine the light          • Distributed source (c): All light rays originate at a finite
intensity at all pixels in the image                          area in space. It models a nearby source, such as a
fluorescent light                        c
b
a
Illumination Models                                    Ambient Illumination
• Simplified and fast methods for calculating            • Assume there is some non-directional light
surfaces intensities, mostly empirical                   in the environment (background light)
• Calculations are based on optical properties
of surfaces and the lighting conditions (no            • The amount of ambient light incident on
reflected sources nor shadows)                           each object is constant for all surfaces and
over all directions
• Light sources are considered to be point
sources                                                • Very simple model, not very realistic
• Reasonably good approximation for most
scenes                                                 • OpenGL default

Ambient Illumination                                    Ambient Illumination
• The reflected intensity Iamb of any point on the        • Example:
surface is:

Iamb = Ka Ia

Ia - ambient light intensity
Ka [0,1] - surface ambient reflectivity

• In principle Ia and Ka are functions of color, so we
have IRamb, IGamb and IBamb

Diffuse Reflection                                        Diffuse Reflection
• Diffuse (Lambertian) surfaces are rough or grainy,     • Brightness is proportional to cos( ) because a
like clay, soil, fabric                                  surface (a) perpendicular to the light direction is
more illuminated than a surface (b) at an oblique
• The surface appears                                      angle
equally bright from all                                           a                          b
viewing directions

• The brightness at each                       L                                         L
N                                         N
point is proportional to
cos( )
Diffuse Reflection                                    Diffuse Reflection
• The reflected intensity Idiff of a point on the     • Example:
surface is:

Idiff = Kd Ipcos( ) = Kd Ip(N L)
Ip - the point light intensity. May appear as
attenuated source fatt(r)IP
Kd [0,1] - the surface diffuse reflectivity
N - the surface normal
L - the light direction

NOTE: If N and L have unitary length: cos( ) = N L

Diffuse Reflection                                    Diffuse Reflection
• Example: diffuse reflection from different        • Commonly, there are two types of light sources:
light directions                                     – A background ambient light
– A point light source

• The equation that combines the two models is:

I = Idiff + Iamb = Kd Ip N L + Ka Ia

• Note this is the model for one color and it should
be replicated for each channel: IR, IG and IB

Diffuse Reflection                                  Specular Reflection
• Example:                                          • Models shiny and glossy surfaces (like metal,
0          0.3          0.6   Kd      plastic, etc..) with highlights
• Reflectance intensity changes with reflected angle
0.3                                           • An ideal specular surface (mirror) reflects light
exclusively in one direction: R
• Glossy objects are not ideal mirrors and reflect
0.5                                             in the immediate vicinity of R
N                           N
L           R               L           R
V
0.7
Ideal specular surface   Non-ideal specular surface
Ka
Specular Reflection                                              Specular Reflection
• The Phong Model: reflected specular intensity       • The Phong Model: plots of cosn( ) for three
falls off as some power of cos ( ):                   values of the specular parameter n
1
Ispec = Ks Ipcosn( ) = Ks Ip(R V)n                 n=1
0.8    n=8
Ks - the surface specular reflectivity                  n=64
N
0.6                                                              L             R
n – specular reflection parameter, determining
V
the deviation from ideal specular surface   0.4

(for a perfect mirror n= )                   0.2
Specular surface
N
L           R                  0
-2     -1.5    -1      -0.5    0    0.5   1         1.5   2
V

Specular surface

Specular Reflection                                              Specular Reflection
• The illumination equation combined with diffuse     • Example:                                                           Ks
0.2             0.5              0.8
reflection is:

I = Iamb+Idiff+Ispec=                                      0

Ka Ia + Ip (Kd N L + Ks (R V)n)
0.3
• If k light sources are present in the scene:

I= Iamb+          k      k
k (I diff+I spec)
0.7

Kd

Specular Reflection                                              Specular Reflection
• Example: effects of the specular parameter n         • Example:

Ambient Illumination

n=50
Ambient + Diffuse

n=10
Ambient + Diffuse + Specular
n=3
Composing Light Sources                               Polygon Rendering Methods
• Example:                                                • A freeform surface can be approximated
by polyhedra

• Rendering: calculate the illumination at
each surface point

• Applying the illumination model at each
surface point is computationally expensive

• A single intensity is calculated for each surface      • Renders the polygon surface by linearly
polygon                                                 interpolating intensity values across the surface
• Fast and simple method
• Gives reasonable result only if all of the following
assumptions are valid:
– The object is a polyhedron                            1. Determine the normal at each polygon vertex
– Light source is far away                              2. Apply an illumination model to each vertex to
from the surface so that                                 calculate the vertex intensity
N•L is constant over each                             3. Linearly interpolate the vertex intensities over
polygon
the surface polygon
– Viewing position is far away
from the surface so that V•R
is constant over each polygon

• The normal Nv of a vertex is an average of all         • Interpolation of the vertex intensities
neighboring normals:                                              y
N   k
I3
k
N   V
I1                         IP
N   k
scan line
k                                                        I4                      I5
I2
x
y   4        y   2          y   1    y    4
I4                             I1                           I2
y   1        y   2          y   1    y    2

y   5        y   2          y   3     y       5
I5                             I3                           I2
y   3        y   2          y   3     y       2

x   5        x   p          x   p     x       4
Ip                             I4                            I5
x   5        x   4          x   5     x       4
• Example: Gouraud shading of a sphere
• A more accurate method for rendering a polygon
surface is to interpolate normal vectors, and then
apply the illumination model to each surface point

1. Determine the normal at each polygon vertex
2. Linearly interpolate the vertex normals over
the surface polygon
3. Apply the illumination model along each scan
line to calculate intensity of each surface point

• Example: Phong shading of a sphere      • Example:

Flat

Gouraud

Phong

Polygon Rendering Methods                  Polygon Rendering Methods
• Example:                                • Example:

Flat

Gouraud             Flat                     Gouraud

Phong

Phong

```
To top