Illumination in Computer Graphics
Illumination in Computer Graphics
Why Lighting?
Color is a fundamental attribute of our viewing
experience. The perception of color arises from light
energy entering our visual system.
This complex process is relevant to computer
graphics because a realistic image is one that seems
indistinguishable from the light energy coming from a
real scene.
If we don’t have lighting effects nothing looks three
dimensional!
Why Lighting? (cont…)
Basics of Reflected Light
The colours that we perceive are determined by the
nature of the light reflected from an object
For example, if white
light is shone onto a
green object most
wavelengths are
absorbed, while green
light is reflected from Colours
Absorbed
the object
Basics of Reflected Light
The amount of incident light reflected by a surface
depends on the type of material
Shiny materials reflect more of the incident light and
dull surfaces absorb more of the incident light
For transparent surfaces some of the light is also
transmitted through the material
Components of Reflections
Diffuse – reflection from incident light with equal intensity in all directions.
Depends on surface properties.
Specular – near total of the incident light around reflection angle.
6
Real Lights and Reflection
Real lights are complicated
Sun light, iridescent bulbs, fluorescent bulbs
Different spectra in different directions
Again, pretty complicated
May be described by bidirectional reflectance distribution
function (BRDF)
Besides
The incoming light can come from a source, or bouncing
off another object, or after multiple bounces
Sources can be extended
Multiple interactions between light and surface
Illumination Model
An illumination model, also called a lighting model is
used to calculate the intensity of light that we
should see at a given point on the surface of an
object.
Done by simulating some light attributes
Can be
Local illumination
Global illumination
8
Illumination Model
Local illumination
Models only the direct illumination from the source
Does not consider light reaching after bouncing off other objects
Only consider the light, the
observer position, and the
object material properties
Global illumination
take into account the interaction
of light from all the surfaces in
the scene
9
Things to Model
Light sources
What color, intensity, lines through space
Reflection of light off surfaces
How much light reflected in each direction
How are color and intensity changed
Life on a surface
L: direction to light
N: normal vector
R: reflection of light about normal
V: direction to viewer (i.e. reflection
direction of interest)
Point Light Sources
Simplest model we can use for a light source
Defined by:
The position (x,y,z) of the light
The RGB values for the colour of the light
Radiates equal intensity in all direction
L = Plight - Psurface
Directional Light Sources
A large light source, like the sun, can be modelled as
a point light source
However, it will have very little directional effect
i.e. All light rays are considered parallel
Specified by:
• direction (x,y,z)
• intensity (r,g,b)
L = -direction
Intensity Attenuation
As light moves from a light source its intensity
diminished
At any distance d away from the light source the
intensity diminishes by a factor of 1
d2
This means that
a surface close to the light source (small d) receives a
higher incident intensity from the source than a distant
surface (large d).
Intensity Attenuation
However, using the factor 1 2 does not produce very good
d
results so we use something different
We use instead in inverse quadratic function of the form:
a is a constant
Phong Model
Phong model is an empirical model developed in 1973
by Phong Bui Tuong
Simple and fast method for calculating surface intensity
at a given point
Gives reasonably good results and is used in most
graphics systems
The important components are:
Ambient light
Diffuse reflection
Specular reflection
Emissive light
For the most part we will consider only monochromatic
light sources
Ambient Light
A surface that is not exposed
to direct light may still be lit
up by reflections from other
nearby objects – ambient
light
The total reflected light from
a surface is the sum of the
contributions from light
sources and reflected
light
Ambient Light
To incorporate background light Phong model simply
set a general brightness level for a scene
This approximates the global diffuse reflections
(inter-reflections) from various surfaces within the
scene
This light intensity is simply denoted by Ia,
It is
Independent of the light positions or surface directions
Independent of location of viewer
Has no direction
Diffuse Reflection
Surfaces that are rough or grainy tend to reflect light
in all directions
This scattered light is called diffuse reflection
This type of reflection is called Lambertian Reflection
(thus, Lambertian surfaces)
The brightness of the surface is independent of the
observer position (since the light is reflected in all
direction equally)
Diffuse Reflection (cont…)
Surface’s material property:
A parameter kd is set for each surface
kd determines the fraction of light that is to be scattered as
diffuse reflections from that surface
This parameter is known as the diffuse-reflection
coefficient or the diffuse reflectivity
kd is assigned a value between 0.0 and 1.0
0.0: dull surface that absorbs almost all light
1.0: shiny surface that reflects almost all light
Diffuse Reflection – Ambient Light
For background lighting effects we can assume that
every surface is fully illuminated by the scene’s
ambient light Ia
Therefore the ambient contribution to the diffuse
reflection is given as:
I ambdiff kd I a
Ambient light alone is not enough to render a scene
or very uninteresting so we need some other lights in
a scene as well
Diffuse Reflection (cont…)
When a surface is illuminated by a light source, the
amount of incident light depends on the orientation of
the surface relative to the light source direction
N θ = angle of incidence
Il
Incident
light
Diffuse Reflection (cont…)
So the amount of incident light on a surface is given
as:
I l ,incident I l cos
So we can model the diffuse
reflections as: I l ,diff k d I l ,incident
k d I l cos
k d I l ( N L ) if N L 0
I l ,diff
0 if N L 0
Combining Ambient And Incident Diffuse Reflections
k a I a k d I l ( N L ) if N L 0
I diff
ka I a if N L 0
Examples
Specular Reflection
Additionally to diffuse reflection we see a
highlight, or bright spot, on objects (such
as polished metal, apple ...) at certain
viewing directions.
This phenomenon, called specular
reflection,
It is the result of total, or near total reflection
of the incident light in a concentrated region
around the specular reflection angle.
Specular Reflection (cont…)
A perfect mirror reflects light only in the specular-
reflection direction
Other objects exhibit specular reflections over a finite
range of viewing positions around vector R
Specular Reflection Model
The Phong model sets the intensity of specular reflection as
proportional to the angle between the viewing vector and the
specular reflection vector
V R cos
Remembering that
We can say:
k s I l (V R) ns if V R 0 and N L 0
I l , spec
0.0 if V R 0 or N L 0
Example
Calculating Reflection Vector
36
Combining Diffuse & Specular Reflections
For a single light source we can combine the effects
of diffuse and specular reflections simply as follows:
I I diff I spec
k a I a k d I l ( N L) k s I l (V R) ns
Example
Example
Ambient Diffuse
Final
Specular Image
Emission
Some objects are self-luminous
Light intensity due to emission is measured as –
I e ki
Therefore,
I I diff I spec I e
Multiple Light Sources
We can place any number of light sources in a scene
We compute the diffuse and specular reflections as
sums of the contributions from the various sources
n
I I ambdiff I l ,diff I l ,spec
l 1
n
k a I a I l kd N L k s V R
ns
l 1
Adding Intensity Attenuation
To incorporate radial and angular intensity
attenuation into our model we simply adjust our
equation to take these into account
So, light intensity is now given as:
I I ambdiff f l ,radatten f l ,angattenI l ,diff I l , spec
n
l 1