0% found this document useful (0 votes)
36 views34 pages

CS 445 / 645: Introductory Computer Graphics: Light

This document discusses lighting and shading models used in computer graphics. It defines key terms like illumination, lighting, and shading. It describes common lighting components like ambient light sources, directional light sources, and point light sources. It explains Lambert's cosine law for diffuse reflection and Phong lighting model for both diffuse and specular reflection. The Phong model combines ambient, diffuse, and specular components to calculate the final color at each point on a surface.

Uploaded by

jagoxwar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views34 pages

CS 445 / 645: Introductory Computer Graphics: Light

This document discusses lighting and shading models used in computer graphics. It defines key terms like illumination, lighting, and shading. It describes common lighting components like ambient light sources, directional light sources, and point light sources. It explains Lambert's cosine law for diffuse reflection and Phong lighting model for both diffuse and specular reflection. The Phong model combines ambient, diffuse, and specular components to calculate the final color at each point on a surface.

Uploaded by

jagoxwar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

CS 445 / 645:

Introductory Computer Graphics


Light
Lighting
Sogiven a 3-D triangle and a 3-D viewpoint,
we can set the right pixels
But what color should those pixels be?
If were attempting to create a realistic image,
we need to simulate the lighting of the
surfaces in the scene
Fundamentally simulation of physics and optics
As youll see, we use a lot of approximations (a.k.a
hacks) to do this simulation fast enough
Definitions
Illumination: the transport of energy from
light sources to surfaces & points
Note: includes direct and indirect illumination
Lighting: the process of computing the
luminous intensity (i.e., outgoing light) at a
particular 3-D point, usually on a surface
Shading: the process of assigning colors to
pixels
Definitions
Illumination models fall into two categories:
Empirical: simple formulations that approximate
observed phenomenon
Physically based: models based on the actual
physics of light interacting with matter
We mostly use empirical models in
interactive graphics for simplicity
Increasingly, realistic graphics are using
physically based models
Components of Illumination
Two components of illumination: light
sources and surface properties
Light sources (or emitters)
Spectrum of emittance (i.e., color of the light)
Geometric attributes
Position
Direction
Shape
Directional attenuation
Components of Illumination
Surface properties
Reflectance spectrum (i.e., color of the surface)
Geometric attributes
Position
Orientation
Micro-structure
Common simplifications in interactive
graphics
Only direct illumination from emitters to surfaces
Simplify geometry of emitters to trivial cases
Ambient Light Sources
Objects not directly lit are typically still visible
E.g., the ceiling in this room, undersides of desks
This is the result of indirect illumination from
emitters, bouncing off intermediate surfaces
Too expensive to calculate (in real time), so
we use a hack called an ambient light source
No spatial or directional characteristics;
illuminates all surfaces equally
Amount reflected depends on surface properties
Ambient Light Sources
For each sampled wavelength, the ambient
light reflected from a surface depends on
The surface properties, k
ambient
The intensity of the ambient light source (constant
for all points on all surfaces )
I
reflected
= k
ambient
I
ambient
Ambient Light Sources
A scene lit only with an ambient light source:
Directional Light Sources
For a directional light source we make the
simplifying assumption that all rays of light
from the source are parallel
As if the source were infinitely far away
from the surfaces in the scene
A good approximation to sunlight
The direction from a surface to the light
source is important in lighting the surface
With a directional light source, this direction
is constant for all surfaces in the scene
Directional Light Sources
The same scene lit with a directional and an
ambient light source
Point Light Sources
A point light source emits light equally in all
directions from a single point
The direction to the light from a point on a
surface thus differs for different points:
So we need to calculate a
normalized vector to the light
source for every point we light:
p
l
Point Light Sources
Using an ambient and a point light source:
Other Light Sources
Spotlights are point sources whose intensity
falls off directionally.
Requires color, point
direction, falloff
parameters
Supported by OpenGL
Other Light Sources
Area light sources define a 2-D emissive
surface (usually a disc or polygon)
Good example: fluorescent light panels
Capable of generating soft shadows (why? )
Ideal diffuse reflection
An ideal diffuse reflector, at the microscopic level,
is a very rough surface (real-world example: chalk)
Because of these microscopic variations, an
incoming ray of light is equally likely to be
reflected in any direction over the hemisphere:
What does the reflected intensity depend on?
The Physics of Reflection
Lamberts Cosine Law
Ideal diffuse surfaces reflect according to
Lamberts cosine law:
The energy reflected by a small portion of a surface from a light
source in a given direction is proportional to the cosine of the angle
between that direction and the surface normal
These are often called Lambertian surfaces
Note that the reflected intensity is
independent of the viewing direction, but
does depend on the surface orientation with
regard to the light source
Lamberts Law
Computing Diffuse Reflection
The angle between the surface normal and
the incoming light is the angle of incidence:
I
diffuse
= k
d
I
light
cos u
In practice we use vector arithmetic:
I
diffuse
= k
d
I
light
(n l)
n l
u
Diffuse Lighting Examples
We need only consider angles from 0 to 90
(Why?)
A Lambertian sphere seen at several
different lighting angles:
Attenuation: Distance
f
att
models distance from light
I
diffuse
= k
d
f
att
I
light
(n l)
Realistic
f
att
= 1/(d
light
)
2
Hard to control, so use
f
att
= 1/(c
1
+ c
2
d
light
+ c
3
d
light
2
)
Specular Reflection
Shiny surfaces exhibit specular reflection
Polished metal
Glossy car finish
A light shining on a specular surface causes
a bright spot known as a specular highlight
Where these highlights appear is a function
of the viewers position, so specular
reflectance is view-dependent
The Physics of Reflection
At the microscopic level a specular reflecting
surface is very smooth
Thus rays of light are likely to bounce off the
microgeometry in a mirror-like fashion
The smoother the surface, the closer it
becomes to a perfect mirror
The Optics of Reflection
Reflection follows Snells Laws:
The incoming ray and reflected ray lie in a plane
with the surface normal
The angle that the reflected ray forms with the
surface normal equals the angle formed by the
incoming ray and the surface normal:
u
(l)ight
= u
(r)eflection
Non-Ideal Specular Reflectance
Snells law applies to perfect mirror-like
surfaces, but aside from mirrors (and chrome)
few surfaces exhibit perfect specularity
How can we capture the softer reflections of
surface that are glossy rather than mirror-like?
One option: model the microgeometry of the
surface and explicitly bounce rays off of it
Or
Non-Ideal Specular Reflectance:
An Empirical Approximation
In general, we expect most reflected light to
travel in direction predicted by Snells Law
But because of microscopic surface
variations, some light may be reflected in a
direction slightly off the ideal reflected ray
As the angle from the ideal reflected ray
increases, we expect less light to be reflected
Non-Ideal Specular Reflectance:
An Empirical Approximation
An illustration of this angular falloff:
How might we model this falloff?
Phong Lighting
The most common lighting model in
computer graphics was suggested by Phong:
( )
shiny
n
light s specular I k I cos =
The n
shiny
term is a purely
empirical constant that
varies the rate of falloff
Though this model has no
physical basis, it works
(sort of) in practice
v
Phong Lighting: The n
shiny
Term
This diagram shows how the Phong
reflectance term drops off with divergence of
the viewing angle from the ideal reflected ray:
What does this term control, visually?
Calculating Phong Lighting
The cos term of Phong lighting can be
computed using vector arithmetic:
V is the unit vector towards the viewer
R is the ideal reflectance direction
An aside: we can efficiently calculate R
( )
shiny
n
light s specular R V I k I

=
( ) ( ) L N L N R

2

=
Calculating The R Vector
This is illustrated below:
( ) ( ) L N L N R

2

=
( ) ( )N L N L R

2

= +
Phong Examples
These spheres illustrate the Phong model as
L and n
shiny
are varied:
The Phong Lighting Model
Lets combine ambient, diffuse, and specular
components:
Commonly called Phong lighting
Note: once per light
Note: once per color component
Do k
a
, k
d
, and k
s
vary with color component?
( ) ( )

=
|
.
|

\
|
+ + =
lights
i
n
s d i ambient a total
shiny
R V k L N k I I k I
#
1

Phong Lighting: Intensity Plots

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy