Beruflich Dokumente
Kultur Dokumente
Table of Contents
Realistic rendering:
Basic effects
What is Rendering?
Rendering techniques
Elimination of hidden surfaces/faces: Z-buffer
Raytracing and radiosity
Light models
Shading
Textures
T
What is Rendering?
Projection
3D transformations and perspective (already covered): scaling,
rotation,, translation,, p
perspective
p
transformations,, clipping
pp g
Hidden surface removal: back-face culling, z-buffer, painters
algorithm, Warnocks
Realism
Light and shading: Diffuse and specular reflection, Phong &
Gouraud shading models
Ray tracing: Ray-tracing model,
d l reflective
fl
& transparent objects
b
Color: Gamma correction halftoning & color models
In figure a),
a) which cube is in front?
Ambiguous image caused by some line segments which
shouldnt be shown
10
Back-face Culling
11
Z-Buffer Algorithm
One of most commonly used routines
Often
Oft implemented
i
l
t d iin h
hardware
d
Idea behind very simple:
assign z-value to each polygon
then display the one (pixel by pixel)
that has the smallest value
12
Z-Buffer Algorithm
Consider these 2 polygons (P1 and P2)
C
Computer
t would
ld start
t t ((arbitrarily)
bit il ) with
ith P
Polygon
l
1
and put it's depth value into buffer. It would do
same for next polygon, P2
It will then check each overlapping pixel and check
to see which one closer to viewer, and display
appropriate color
Basic ideas valid for polygons in any orientation
and permutation
14
Z-Buffer Algorithm
No ambiguities
However:
- Takes up lot of memory
- Can't do transparent surfaces without additional code
13
15
16
Camera
17
18
19
20
21
22
window
window
window
a
b
23
24
25
Color Systems
26
27
28
Hue represented
p
by
y angle
g with origin
g in the circle
The 3 primary colors form regular hexagon
29
30
Transparency
31
32
Simple transparency
Simple transparency
g
The color of the box will be a mixture of red and green
Proportions of red and green is dependent on
transmission (transparency) coefficient of the glass
If the glass is completely opaque, the result should be
green (the box is not visible !); if the glass is completely
transparent, the result should be red (like without glass)
33
34
35
36
Variation of transparency
37
38
Synthetic light
39
40
Variation of
position of
point light
source
intensity of
point light
source with
shadow
intensity of
point light
source no
shadow
intensity
y of
ambient light
10
41
42
Spots
Spots: variations of
concentration factor
direction
their position
their direction
a concentration factor
43
44
11
45
Types of reflection
46
Specular Reflection
A large proportion of the incident light is reflected over a
narrow range of angles, making the surface look shiny.
Combined Reflection
in practice, many materials exhibit both of these effects to
different degrees.
47
48
Surface Orientation
The geometry of the reflection process:
Angle of incidence
12
49
Illumination Model 1
50
51
52
Diffuse Reflection
The intensity of diffusely reflected light can be calculated
as follows:
13
53
Illumination Model 2
54
I = ambient + diffuse
I = kala + kdlp(NL)
kd
55
Specular Reflection
Snells law:
Light reaching the object is reflected in the direction having
the same angle:
56
I = Ip ks (cos)n
Ap
problem
ob e o
of tthis
s model
ode is:
s with
t po
pointt light
g t sou
source,
ce, tthe
e
effect is visible only at one point on the surface
This is useful for indirect illumination (reflection and
shadows)
14
57
58
Phong Model
f()=cosn
n depends on surface properties ans controls the spread of
the specular highlight
for a perfect reflector n =
For a very poor reflector n = 1
59
60
Illumination Model 3
Variation of highlight
Variation of reflectance
ks
15
61
62
Illumination Model 4
63
64
Torrance-Sparrow Model
16
65
Torrance-Sparrow Model
66
Torrance-Sparrow
Depends
D
d on th
the geometrical
t i l distribution
di t ib ti
off th
the ffacets
t
67
Torrance-Sparrow
68
Polygon Shading
Typically, objects are represented by meshes of polygons
Our illumination model computes the intensity at a single point
on a surface
How can we compute the
h intensity across the
h polygon?
l
?
Compute the shade at the centre and use this to represent the
whole polygon: flat shading
Compute the shade at all points: unnecessary and impractical
Compute the shade at key points and interpolate for the rest:
Gouraud and Phong shading
17
69
Flat shading
70
Flat shading
Original Model
Optimized
Spot
Gouraud
Phong
71
72
Intensity interpolation
First compute intensity values at each polygon vertex
We need the vertex normals
Compute
C
t vertex
t normall approximately
i t l b
by averaging
i
th
the
surface normals of surrounding polygons
18
73
Intensity interpolation
74
75
Gouraud shading
76
Original Model
19
77
78
79
80
Phong shading
20
Next session
Realistic rendering:
Advanced effects
21