CM0304 Graphics I Graphics Hardware I.1 Graphics Systems
CMT107 Visual Computing
Copyright By PowCoder代写 加微信 powcoder
IV.1 Illumination Models
Xianfang Sun
School of Computer Science & Informatics
Cardiff University
➢ Illumination Concepts
➢ Light Reflection model
• Phong illumination model
➢Light source types
➢OpenGL lighting
15:15 2CMT107 Visual Computing
Illumination Concepts
15:15 3CMT107 Visual Computing
➢ Illumination: transport of luminous flux from light sources
between points via direct and indirect paths
➢ Lighting: computing luminous intensity reflected from a
specific 3D point
➢ Shading: assigning colours to a pixel
➢ Illumination Models: Simple approximations of light transport
Light-Surface Interaction
15:15 4CMT107 Visual Computing
➢ Light and surface properties determine the illumination
➢ Light that strikes an object is partially absorbed and
partially reflected
➢ The amount reflected determines the colour and
brightness of the object (subtractive colours)
➢ Reflected light is scattered depending on the smoothness
and orientation of the surface
Modelling Surface Reflectance
15:15 5CMT107 Visual Computing
➢ Compute light reflected by surface as observed by viewer
➢ Surface material tells how much of the incoming light is
• Type of light determines reflection model
➢ Intensity of observed light depends on direction to light
source and direction to viewer
Light Reflection Types
15:18 6CMT107 Visual Computing
➢ Ambient light: comes from all directions, is scattered in
all directions
➢ Diffuse light: comes from one direction, is scattered in
all directions
➢ Specular light: comes from one direction, reflected in
preferred direction (highlights)
Ambient Reflection
15:18 7CMT107 Visual Computing
➢ Ambient light is the same everywhere
• Amount of reflected light of incoming intensity
is independent of direction to light source and viewer
➢ Intensity of reflected light observed by a viewer:
• is ambient material property for colour c
(percentage of red, green or blue ambient light
reflected by surface)
Diffuse Reflection
15:18 8CMT107 Visual Computing
➢ Light is reflected in all directions
• Amount of reflected light of incoming intensity
depends only on direction to light source
➢ Lambertian model (use cosine law / scalar product):
• d: unit direction from surface point to light source
• n: unit surface normal
Specular Reflection
15:18 9CMT107 Visual Computing
➢Light is reflected preferable in direction of perfect reflection
• Amount of reflected light of incoming intensity
depends on direction to light source and to viewer
➢Observed light intensity:
• r: unit direction of perfect reflection of d
• v: unit direction towards viewer position
• is shininess exponent
Surface Light Emissions
15:18 10CMT107 Visual Computing
➢ Can make surface emit light, not just reflect light
➢ Simple model:
• Add emissive light intensities Et,c to light intensities for
each light type t and colour c
• Does not illuminate other surfaces
(but can add a multiple point light sources behind
surface or a directional light source for larger light
emitting surfaces)
15:18 11CMT107 Visual Computing
➢ Putting everything together gives the
➢ Consider monochromatic light (e.g. red, green or blue)
and a single light source:
• Depending on light source type, at a surface point the
incoming intensity of different light types is
• The intensity of reflected light is:
• Summation over all light sources for red, green, blue
gives total intensity for all colours
➢ Note, Phong’s illumination model is not physically
Light Source Types
15:18 12CMT107 Visual Computing
➢ Ambient light source: light from the environment
➢ Directional light source: light from infinite distance
in a specified direction
➢ Point light source: light from single point
➢ Spot light source: light emitted in a cone
➢ other light source: area light source, extended light
source etc.
Ambient Light Source
15:18 13CMT107 Visual Computing
➢ An object not directly lit is still visible
• Caused by light reflected from other surfaces
➢ Modelled by a single ambient light source
• Instead of computing surface reflections, specify
constant ambient light for all surfaces
• Defined solely by ambient RGB light intensities
➢ Intensity arriving at point p from an ambient light of
intensity and colour c :
Directional Light Source
15:18 14CMT107 Visual Computing
➢ Light from a source infinitely far away
• Defined by intensities of emitted RGB light of all types,
• direction (and no position)
➢ Intensity arriving at point p from a directional light of
intensity Lt,c :
Point Light Source
15:18 15CMT107 Visual Computing
➢ Light emitted radially from single point in all directions
• Defined by intensities of emitted RGB light for all types,
• position l (and no direction),
• constant, linear and quadratic attenuation (kc, kl, kq)
➢ Intensity arriving at point p from a point light of intensity
Spot Light Source
15:18 16CMT107 Visual Computing
➢ Light emitted in a cone
• Defined by intensities of emitted RGB light for all types,
• position l, unit cone direction s, spot cut-off exponent,
• constant, linear and quadratic attenuation (kc, kl, kq)
➢ Intensity arriving at point p from an point light of intensity
Light Source “Visibility”
15:18 17CMT107 Visual Computing
➢ Angle cut-off for spot lights:
• If position p is outside light cone (sTd = cos < cos with
and cone semi-angle ), set I to 0
➢Light source behind surface:
• Diffuse and specular light only reflected if light source is
in front of surface at p
• Set diffuse and specular light intensities from light
sources to 0 if nTd 0
– n: unit surface normal at p
– d: unit direction from p to light source
• This distinguishes between front and back of surfaces /
polygons (also see two-sidedness)
lplpd −−= )(
OpenGL lighting
15:18 18CMT107 Visual Computing
➢ Fixed-function pipeline version of OpenGL (old version)
uses specific functions to define lighting and material
properties. And lighting effects are realised inside the
OpenGL pipeline
➢ Shader version of OpenGL (new version) needs the
programmer to write code in the main program and/or
the shaders to implement lighting effects
➢ More details in the labs …
Surface Normal Vectors
15:18 19CMT107 Visual Computing
➢ For lighting computations OpenGL requires normal vectors
of polygonal primitives
• Orthogonal to surface pointing outwards
• Used to compute reflection angle
➢ Normals are sent to the vertex shader together with
vertex coordinates
➢ Normals should be unit vectors
• The function normalize() in shaders can be used to
convert a vector to a unit vector:
Vn = normalize(V);
15:18 20CMT107 Visual Computing
➢What is ambient, diffuse and specular light? How is the
amount of reflected light for each light type computed?
➢What is the Phong illumination model?
➢What are ambient, directional, point and spot light
sources? How is the light intensity arriving from one of
these light sources at a surface point computed?
➢ Distinguish light reflection types and light source types.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com