Ch 1
Ch 1
Models for
Graphics
CS 211A
Can be very complex
• 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
Very simple models
• Assumes point light source
• Models only the direct illumination
from the source
– Does not consider light reaching after
bouncing off other objects
• Illumination models evaluated at
different levels
For every vertex
• Ambient component
• Diffused component
• Specular component
Ambient Component
• Equal amount of light from all
directions
• Approximates the indirect
illumination
• Iaka
– Ia = intensity of ambient light
– ka= percentage of the light reflected by
the object
Lighting at a point on
surface
• I = Idkdcosθ
– Id = intensity of light
– kd = coefficient of
diffuse reflection
• I = Idkd(N.L)
N R
L
θ θ
P
Surface
Diffused Component
• I = Idkd(N.L)
• kd is reflectivity
• No dependency on viewer
– View independent
N R
L
θ θ
P
Surface
Ambient and Diffused
Lighting
I = Ipkd(N.L)
I = (Iaka +Ipkd(N.L))
Specular Component
• IsksCosn(α) L R
V
• Cos(α): fall off as V θ θ
α
• n gives the
sharpness
Specular Component
• R depends on L L R
V
• Depends on both V θ θ
α
and L
• n controls the P
view-dependency
also
Providing Control
• Providing enough control so that one
can simulate effect via trial and error
of many different parameters
• May be not be close to the physical
phenomenon
• For e.g. Different brightness of the
same light can be used for different
component computation
Attenuation Control
• Diffused component
• I = Idfattkd(N.L)
– fatt = 1/(a+bd+cd2)
• d = distance of light from the surface
• a, b and c are user defined constants
Attenuation of Light
a=0, b=0, c=1
Gouraud Phong
• Normal of a triangle
– N = (B-A) x (C-A)
C
• Vertices are in
anticlockwise direction
with respect to normal
B
• Normal of a vertex
– Average of all the
triangle incident on the
vertex
– Nv = (N1+N2+N3+N4)/4
Flat Shading
Gouraud Shading
Phong Shading
Shading
• Independent of the Illumination
model used
• Phong Shading and Phong
Illumination
• Artifacts
– Piecewise planar approximation
– Screen Space Interpolation
• Simple and hence widely used
Artifacts: Mach Bands
At discontinuities
Actual Intensity
Percieved Intensity
Artifacts: Mach Bands
• Common in flat shading since
shading is discontinuous at edges
• Also present in Gouraud shading
– Gradient of the shading may change
suddenly
• Phong shading reduces it
significantly
– But cannot be eliminated
– At sharp changes in surface gradient
Artifacts: Screen Space
Interpolation
S1
• Shading is interpolated Sp
while rasterization
S2
• Sp = (S1+S2)/2
– zs = (z1+z2)/2
Artifacts: T-junctions
• The shading at the T-junction are
different when calculated from
different triangles
• Shading discontinuity
B
A D
C
Artifacts:Vertex Normals
• Vertex normal does not reflect the
curvature of the surface adequately
–Appear more flat than it actually
is