illumination models. introduction 1 illumination model: given a point on a surface, what is the...
DESCRIPTION
Introduction 2 Example: Illumination model gives color vertices, Surface is displayed via interpolation of these colors.TRANSCRIPT
Illumination Models
Introduction 1
Illumination model: Given a point on a surface, what is the perceived
color and intensity? Known as Lighting Model, or Shading Model
Surface rendering:Apply the Illumination model to color all pixels
of the surface.
Introduction 2
Example:• Illumination model gives color
vertices, • Surface is displayed via
interpolation of these colors.
Introduction 3
Illumination:• Physics:
– Material properties, light sources, relative positions, properties medium
• Psychology:– Perception, what do we see– Color!
• Often approximating models
Light sources 1
Light source: object that radiates energy.
Sun, lamp, globe, sky…
Intensity I = (Ired , Igreen , Iblue)
If Ired = Igreen = Iblue : white light
Light sources 2
Simple model: point light source- position P and intensity I- Light rays along straight lines- Good approximation for small
light sources
Light sources 3
Simpler yet: point light source at infinity- Direction V and intensity I- Sunlight
V
Light sources 4
Damping: intensity of light decreases with distanceEnergy is distributed over area sphere, hence Il = I / d2,
with d distance to light source.In practice often too ‘agressive’, hence Il = I / (a0 +a1d+a2d2)
If light source at infinity: No damping with distance
d
Light sources 5Directed light source, spotlight:Light is primarily send in direction of Vlight .
PQ
d.illuminate is then cos||
If
:Or d.illuminate is then coscos If
llight
l
QVPQPQ
Q
l
light cone
Vlight
Light sources 6More subtle: Let I decrease with increasing angle
PQ
decreases.light hestronger t the,larger The . cos:usedOften
nII n
l
l
light cone
Vlight
Surface illumination 1
• When light hits a surface, three things can happen:
reflection
transmission
absorption
Surface illumination 2
• Suppose, a light source radiates white light, consisting of red, green and blue light.
reflection
transmission
absorption
If only red light is reflected, then we see a red surface.
Surface illumination 3
• Diffuse reflection: Light is uniformly reflected in all directions
• Specular reflection: Light is stronger reflected in one direction.
specular reflection
diffuse reflection
Surface illumination 4
• Ambient light: light from the environment. Undirected light, models reflected light of other objects.
Basic illumination model 1Basic illumination model:
• Ambient light;• Point light sources;
• Ambient reflection;• Diffuse reflection;• Specular reflection.
VP of ,l
a
II
ss
d
a
nkkk
,), ,(
tscoefficien reflection :,,
bluep,greenp,redp, kkkkkkk
p
sda
Basic illumination model 2
• Ambient light: environment light. Undirected light, models reflected light of other objects.
aaamb IkI
Basic illumination model 3
Perfect diffuse reflector: light is reflected uniformly in all directions.
dA/cos
dA
cos cos/
dAdA
area.projectedenergyIntensity
Basic illumination model 4Perfect diffuse reflector: light is reflected uniformly in all directions..
N
L
dA/cos
dA Lambert’s law:Reflected energy isproportional with cos , where denotes the angle between the normal N and a vector to the lightsource L.
Basic illumination model 5
Perfect diffuse reflector: light is reflected uniformly in all directions.
N
L
Il
||
and 10with 0 if00 if)(
:reflection diffuse model Graphics
surfsource
surfsource
diffl,
PPPPL
LNLNLN
d
ld
k
IkI
Psurf
Psource
Basic illumination model 6
Perfect specular reflector: light is only reflected in onedirection. Angle of incidence is angle of reflection.
N
L R
Basic illumination model 7Imperfect specular reflector: light is distributed in the direction of the angle of reflection, dependent on the roughness of the surface.
N
L R
N
L R
glad ruw
Basic illumination model 8
Phong model: empirical model for specular reflection
N
L
RV
viewerdirection :light ofray reflecteddirection :
, and between angle :, and between angle :
glad),100 ruw,(1 smoothness ,)(with
,cos)(,
VR
VRLN
s
s
nlspecl
nkW
IWI s
Basic illumination model 9
Phong model: empirical model for specular reflection
N
L
RV
0or 0 if0
0 and 0 if
)(
,
LNRV
LNRV
RV snls
specl
Ik
I
Basic illumination model 10
Phong model: calculating the vectors
NL R )2(
hence)2(
LNLNR
NLNLR
L
N.L V
|| surfview
surfview
PPPPV
Basic illumination model 11
N
L
RV
H|VL|
VLH
Phong model: variant with halfway vector H.Use instead of
)(,sn
lsspecl IkI HN
If light source and viewer far away:H constant.
Basic illumination model 12
n
llsldaa
lsldaa
specdifamb
IkIkIkI
IkIkIk
IIII
1
n
n
s
s
)),0(max()),0(max(
:sourceslight Multiple
)),0(max()),0(max(
HNLN
HNLN
All together:
Color (reprise):Light intensity I and reflection coefficients k: (r,g,b) tripletsSo for instance:
Plastic: kd is colored (r,g,b), ks is grey (w,w,w)
Metal: kd and ks same color
Basic model: simple but effective. It can be done much better though…
Basic illumination model 13
)),0(max(,,, LN RlRdRdif IkI
Transparancy 1Transparant object:- reflected and transmitted
light- refraction- scattering
Transparancy 2
Snell’s law of refraction:
N
iL R
T
refraction ofindex : ,sinsin
ir
ir
i
r
LNTr
iri
r
i
coscos
and for solve and,
,cos,1.
law, sSnell' Use:Derivation
LNT
NTTT
r
Transparancy 3Thin surface:- double refraction- shift of light ray
Transparancy 3Very thin surface:- Discard shift
opacity :1ncy transpara:
10)1(
:model Simple
transrefl
t
t
t
tt
kk
kIkIkI
Poor result for silhouette edges…
Atmospheric effects 1Atmospheric effects:- dust, smoke, vapor- colors are dimmed- objects less well visible
Atmospheric effects 2
factorn attenuatio :distance:
with ,)(
:atmosphereby n Attenuatio
dedf d
atmo
minmax
min)(:Simplerdd
dddfatmo
atmoatmoobjatmo IdfIdfI )](1[)( :intensity Perceived
= 0.25 + [ 1 0.25 ]
Rendering polygons 1
Basic illumination model:Can be used per point, but that’s
somewhat expensive
More efficient:Illumination model gives color for some
points; Surface is filled in using interpolation of
these colors.
Rendering polygons 2Constant-intensity rendering aka flat surface rendering:• Determine color for center of polygon;• Fill the polygon with a constant color.
Ok if:• Object consists of planar faces, and• Light sources are far away, and• Eye point is far away,or• Polygons are about a pixel in size.
Rendering polygons 2Constant-intensity rendering aka flat surface rendering:• Determine color for center of polygon;• Fill the polygon with a constant color.
Highlights not visible,Facetted appearance, increased by Mach banding effect.
• Human perception: edges are given emphasis, contrast is increased near edges.
Mach banding
Angel (2000)
Rendering polygons 2Gouraud surface rendering:• Determine average normal on vertices;• Determine color for vertices;• Interpolate the colors per polygon (incrementally).
N1
N2
N3
N4
V
n
1k k
n
1k kV
N
NN
Rendering polygons 3
Gouraud surface rendering:• Much better result for curved surfaces• Errors near highlights• Linear interpolation still gives Mach banding• Silhouettes are still not smooth
Gouraud Flat
Rendering polygons 4Phong surface rendering:• Determine average normal per vertex;• Interpolate normals per polygon (incrementally);• Calculate color per pixel.
Fast Phong surface rendering:Like Phong surface rendering, but use
2nd order approximation of color over polygon:
feydxcybxyaxyxI 22),(
Rendering polygons 5
Phong surface rendering:• Even better result for curved surfaces• No errors at high lights• No Mach banding• Silhouettes remain coarse• More expensive than flat or Gouraud shading
Rendering polygons 5
Gouraud
Flat
Phong