Specular Reflection
Download
Report
Transcript Specular Reflection
Graphics
Reflection Model
고려대학교 컴퓨터 그래픽스 연구실
kucg.korea.ac.kr
Graphics Lab @ Korea University
Content
KUCG
Shading
Light sources
Phong reflection model
Point, distant, and spot lights
Diffuse reflection
Specular reflection
Ambient reflection
Computation of vectors
Normal vectors, angle of reflection, and transmitted
light
kucg.korea.ac.kr
Graphics Lab @ Korea University
Shading
KUCG
Determine a color for each filled pixel
How to choose a color
the color of the light source and of the surfaces
determines the color of one or more pixels in the
frame buffer
kucg.korea.ac.kr
Graphics Lab @ Korea University
Light and Matter
KUCG
Color is determined by multiple interactions
among light sources and reflective surfaces
recursive reflection of light between surfaces
accounts for subtle shading
Rendering Equation
kucg.korea.ac.kr
Graphics Lab @ Korea University
Light-Material Interactions
Specular surfaces – mirror
scatter reflected light in a narrow range of angle
Diffuse surfaces – chalk, clay
KUCG
scatter reflected light all directions
Translucent surfaces – glass, water
refraction
specular surface
kucg.korea.ac.kr
diffuse surface
translucent surface
Graphics Lab @ Korea University
Light Sources
KUCG
Illumination function I (x, y, z, θ, φ, λ)
each point (x, y, z) on the surface
direction of emission (θ, φ)
wavelength λ
light source
kucg.korea.ac.kr
Graphics Lab @ Korea University
Modeling Light Sources
KUCG
Simple mathematical models:
ambient light
point light
distant light
spot light
kucg.korea.ac.kr
Graphics Lab @ Korea University
Color Sources
KUCG
Three-color theory
human perceive three primary colors – red, green,
and blue
three-component intensity or luminance function
Ir
I I g
I b
independent calculations
kucg.korea.ac.kr
Graphics Lab @ Korea University
Ambient Light
KUCG
Uniform lighting
identical at every point in the scene
I ar
I a I ag
I a b
kucg.korea.ac.kr
Graphics Lab @ Korea University
Point Sources (1/2)
KUCG
Emit light equally in all directions
p0: point source location
Ip 0 I r p 0 I g p 0 I b p 0
T
proportional to the inverse square distance
Ip, p 0
1
p p0
2
Ip 0
point source illuminating a surface
kucg.korea.ac.kr
Graphics Lab @ Korea University
Point Sources (2/2)
Large finite size of most light sources
KUCG
umbra: full shadow
penumbra: partial shadow
Attenuation
Ip, p 0
1
p p0
2
Ip 0
1
Ip, p 0
Ip 0
2
kc kl d k q d
kucg.korea.ac.kr
shadows created by
finite-size light source
Graphics Lab @ Korea University
Spotlights
KUCG
Characterized by a narrow range of angle
through which light is emitted
ps: apex of a cone
ls: direction of pointing
θ: angle to determine width
spotlight
Distribution of light
concentrate in the center
light intensity drop off
cos s l s
cos s l s
e
kucg.korea.ac.kr
e
attenuation
exponent
Graphics Lab @ Korea University
Distant Light Sources
KUCG
far from the surface vector does not change
location direction
x
y
p0
z
1
x
y
p0
z
0
parallel light source
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (1/5)
KUCG
Efficient and close enough approximation to
physical reality to produce good renderings
Use 4 vectors
n: normal at p
v: direction from p to the viewer or COP
l: direction from light source
r: direction of reflectance
3 types of material-light
interactions
ambient, diffuse, and specular
kucg.korea.ac.kr
vectors used by
the Phong model
Graphics Lab @ Korea University
Phong Reflection Model (2/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
Based on model
proposed by Phong
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (2/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
Based on model
proposed by Phong
kucg.korea.ac.kr
Graphics Lab @ Korea University
Diffuse Reflection (1/3)
KUCG
Assume surface reflects equally in all directions
Examples: chalk, clay
kucg.korea.ac.kr
Graphics Lab @ Korea University
Diffuse Reflection (2/3)
KUCG
How much light is reflected?
Depends on angle of incident light
dL dA cos Q
kucg.korea.ac.kr
Graphics Lab @ Korea University
Diffuse Reflection (3/3)
KUCG
Lambertian model
Cosine law (dot product)
I D K D N LI L
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (2/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
Based on model
proposed by Phong
kucg.korea.ac.kr
Graphics Lab @ Korea University
Specular Reflection (1/3)
KUCG
Reflection is strongest near mirror angle
Examples: mirrors, metals
kucg.korea.ac.kr
Graphics Lab @ Korea University
Specular Reflection (2/3)
KUCG
How much light is seen?
Depends on angle of incident light and angle to
viewer
kucg.korea.ac.kr
Graphics Lab @ Korea University
Specular Reflection (3/3)
KUCG
Phong model
{cos(a)}n
I S KS V R I L
n
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (2/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
Based on model
proposed by Phong
kucg.korea.ac.kr
Graphics Lab @ Korea University
Emission
KUCG
Represents light emitting directly from polygon
Emission ≠ 0
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (2/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
Based on model
proposed by Phong
kucg.korea.ac.kr
Graphics Lab @ Korea University
Ambient Term
KUCG
Represents reflection of all indirect illumination
This is a total hack (avoids complexity of global illumination)!
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (3/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (4/5)
KUCG
Simple analytic model:
Diffuse reflection +
Specular reflection +
Emission +
“Ambient”
kucg.korea.ac.kr
Graphics Lab @ Korea University
Phong Reflection Model (5/5)
KUCG
Sum diffuse, specular, emission, and ambient
kucg.korea.ac.kr
Graphics Lab @ Korea University
Surface Illumination
Calculation (1/2)
KUCG
Single light source:
I I E K A I AL KD N LI L KS V R I L
n
kucg.korea.ac.kr
Graphics Lab @ Korea University
Surface Illumination
Calculation (2/2)
KUCG
Multiple light sources:
I I E K A I AL i ( K D N Li I i K S V R i I i )
n
kucg.korea.ac.kr
Graphics Lab @ Korea University
Computation of Reflection
Light source and reflection term
Rira
Lira Liga Liba
L i Lird Ligd Libd R i Rird
Rirs
Lirs Ligs Libs
KUCG
Riba
Ribd
Rigs Ribs
Ex. red intensity I ir Rira Lira Rird Lird Rirs Lirs
Riga
Rigd
I ira I ird I irs
I r I ira I ird I irs I ar
i
Total Intensity
kucg.korea.ac.kr
I I a I d I s Ra La Rd Ld Rs Ls
Graphics Lab @ Korea University
Ambient Reflection
KUCG
Same at every point on the surface
Ambient reflection coefficient Ra k a
0 ka 1
amount reflected
some of light source is absorbed and some is reflected
three ambient coefficients –
k ar , k ag, and k ab
Ambient reflection term
I a k a La
can be any of the individual light sources
can be a global ambient term
kucg.korea.ac.kr
Graphics Lab @ Korea University
Diffuse Reflection (1/2)
KUCG
Characterized by rough surfaces
perfectly diffuse surface
so rough that there is no preferred
angle of reflection
Lambert’s law
rough surface
only the vertical component of light source
at noon
kucg.korea.ac.kr
in the afternoon
Lambert’s law
Graphics Lab @ Korea University
Diffuse Reflection (2/2)
KUCG
Lambert’s law (cont’)
Rd cos
cos l n
Lambert’s law
Diffuse reflection term
I d k d l nLd
incorporate a distance term
kd
l n Ld
Id
2
kc kl d k q d
kucg.korea.ac.kr
Graphics Lab @ Korea University
Specular Reflection
KUCG
Specular surface is smooth
highlight in the direction of the viewer
specular surface
specular highlights
Specular reflection term
I s ks r v Ls
a
shininess coefficient
α infinite : mirror
100 < α < 500 : metal
α < 100 : broad highlight
kucg.korea.ac.kr
effect of shininess coefficient
Graphics Lab @ Korea University
Illumination Equation
KUCG
I Ia Id Is
Ra La Rd Ld Rs Ls
k a La k d l n Ld k s r v Ls
a
Including the distance term
I k a La k d l n Ld k s r v Ls
a
1
a
k a La
k d l n Ld k s r v Ls
2
kc kl d k q d
kucg.korea.ac.kr
Graphics Lab @ Korea University
Utah Teapots with Different
Material Properties
kucg.korea.ac.kr
KUCG
Graphics Lab @ Korea University
Computation of Vectors (1/2)
Normal vectors
n p1 p 0 p 2 p 0
n
p1
p0
in OpenGL
glNormal3f(nx, ny, nz);
glNormal3fv(pointer_to_normal);
KUCG
p2
Angle of reflection
l n r 1
cos i cos r
l n nr
coplanar condition
n al n
al n
①
②
1 r r a 2 2a l n 2
by ① and ②
kucg.korea.ac.kr
r 2l nn l
mirror
Graphics Lab @ Korea University
Computation of Vectors (2/2)
Halfway vector
lv
h
lv
half-angle: 2ψ=φ
I s ks r v Ls
I s ks n h Ls
a
a
KUCG
halfway vector
Transmitted light
Snell’s law
sin l t
sin t l
1
2
cos t 1 2 1 cos l
1/ 2
1
t l cos t cos l n
kucg.korea.ac.kr
t l
1
perfect light transmission
Graphics Lab @ Korea University