Professional Documents
Culture Documents
by Werner Purgathofer
Illumination Models
light sources
basic models
effects
transparency
atmospheric effects
…
Surface Rendering
Dieter Schmalstieg
1
Ambient Light Reflection Illumination and Shading
constant over a surface shaded surfaces generate a spatial impression
independent of viewing direction
the flatter light falls on a surface,
diffuse-reflection coefficient kd (0≤ kd ≤1) the darker it will appear
therefore:
we need the incident light direction
I ambdiff = kd I a
or
the position of the (point) light source
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
I = ILl · cos α
θ Lambert’s cosine law
I l ,diff = kd I l ( N ⋅ L)
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
2
Ambient and Diffuse Reflection Specular Highlights
total diffuse reflection I l,diff = ka I a + kd I l ( N ⋅ L)
cosns φ
cos64 φ
cos256 φ
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
3
Fresnel Specular Refl. Coefficient Simple Specular Reflection
Fresnel’s laws of Reflection W(θ) ≈ constant for many opaque materials (ks)
specular reflection coefficient W(θ)
L +V
H=
L +V
4
Polygon-Rendering Methods Polygon Shading: Interpolation
application of illumination model to polygon the shading of a polygon is not constant,
rendering because it normally is only an approximation
of the real surface ⇒ interpolation
constant-intensity shading (flat shading)
single intensity for each polygon
Gouraud shading: intensities
Phong shading: normal vectors
flat Gouraud
∑ Nk
1. find normal vectors at corners and calculate
shading (intensities) there: Ii
k =1
NV = n
∑ Nk
k =1
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
I1 I1
I3 v·I +(1–v)· I ' I 3
I= t·I 1+(1-t)·I 2 I'=u·I 2+(1-u)·I 3 I= t·I 1+(1-t)·I 2 I'=u·I 2+(1-u)·I 3
I2 I2
1. find normal vectors at corners and calculate 1. find normal vectors at corners and calculate
shading (intensities) there: Ii shading (intensities) there: Ii
2. interpolate intensities along the edges linearly: I, I’ 2. interpolate intensities along the edges linearly: I, I’
3. interpolate intensities along scanlines linearly: Ip
5
Gouraud Shading Gouraud Shading
interpolating intensities incremental update
y4 − y2 y1 − y4 x5 − xp xp − x4 y − y2 y1 − y I2 − I1
I4 = I + I Ip = I4 + I I= I + I I′ = I +
y1 − y2 1 y1 − y2 2 x5 − x4 x5 − x4 5 y1 − y2 1 y1 − y2 2 y1 − y2
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
dark dark
light dark
dark dark
flat Gouraud
6
Phong Shading Overview Phong Shading Normal Vectors
normal-vector interpolation
P
y − y2
N=
y1 − y2 1 +
N
1. normal vectors at corner points
y1 − y
2. interpolate normal vectors along the edges + N
y1 − y2 2
3. interpolate normal vectors along scanlines
& calculate shading (intensities) for every pixel
pixel area
Blinn, CACM 76
projected onto
surface
reflected onto
environment
map
Haeberli/Segal
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
7
Environment Mapping (4) Adding Surface Detail (1)
most objects do not have smooth surfaces
brick walls
gravel roads
shag carpets
8
Texture-Map.: Cylindrical Surface Texture-Map.: Cylindrical Surface
MVP MT u = s π / 2, v = t
u = θ, with 0 ≤ θ ≤ π/2
v = z with 0 ≤ z ≤ 1
x = r⋅cos u, M-1VP
y = r⋅sin u, pixel → surface point (x,y,z)
z=v (x,y,z) → (u,v): u = tan −1 ( y / x), v= z
M-1T s = 2u / π , t = v
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
9
Bump Mapping (1) Bump Mapping Examples
bumps are visible because of shading
armor surface =
combination of
bump mapping
& environment mapping
& texture mapping
Surface Rendering Surface Rendering
Dieter Schmalstieg Dieter Schmalstieg
Copyright Alias|Wavefront
10