Professional Documents
Culture Documents
Central Institutions
2
Computer Graphics
and Multimedia
Prof. Leif Kobbelt
Exercises
Exercises
5
5. Semester, Pflichtfcher
Modelling
Model
Numerics
Programming
Simulator
Simulation
Simulation Results
Analysis
Problem solved
Application
Simulation
RAW DATA
Visualization
Scientific
Visualization
User
Perception
IMAGE DATA
Information
Visualization
f: -> R
VIS DATA
Rendering
110111101101011
010101111011011
001010010100111
101010101110110
110100101010101
010010101001010
001010111010101
101001010101010
101
010101110101011
1010111100
010111100
raw data
Gigabyte-Terabyte-Petabyte
110111101101011
010101111011011
001010010100111
101010101110110
110100101010101
010010101001010
001010111010101
101001010101010
101
010101110101011
1010111100
010111100
raw data
Gigabyte-Terabyte-Petabyte
Visualization
10
11
110111101101011
010101111011011
001010010100111
101010101110110
110100101010101
010010101001010
001010111010101
101001010101010
101
010101110101011
1010111100
010111100
raw data
Gigabyte-Terabyte-Petabyte
13
14
15
AIA, VR Group
CATS, VR Group
IKV, VR Group
Filtering
Mapping
Rendering
Filtering
= Preprocessing of data
e.g. subsampling, dimension reduction
Mapping
Rendering
= Transformation of render-primitives
to output images
16
Course Outline
20.10.2015
(V1) Introduction & Basics - Rendering (Weyers)
Course Introduction, Organization, Visualization and Rendering Pipeline
27.10.2015
(V2) Basics - Rendering (Nowke)
Shading, Scan Conversion, Texture Mapping
03.11.2015
(1) (Schnorr/Nowke)
(V3) Basics - Perception (Weyers)
Sensory and Abitrary Perception, Human Eye, Color Models, Gestalt Psychology
10.11.2015
(2) (Schnorr/Nowke)
(V4) Basics - Visualization (Kobbelt)
Data types, grid interpolation and integration, & Scalar field visualization: transfer function
design, iso-contouring, volume rendering
17
18
19
20
Organizational Stuff
Script? Course contents, e.g., in A. Watt, CG, und K.-F- Kraiss, AMMI
21
22
Conferences:
23
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
24
View Volume
eye position
(viewpoint)
25
near
clipping plane
viewing window
far
clipping plane
Transformation:
Position und orientation
of objects
Clipping
Shading
26
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
1. Transformations:
Describe position & orientation of objects within a scene
Transform local coordinates of objects into a single world coordinate
system (WKS)
Optional: Transform into a view Coordinate system (SKS):
viewpoint = origin
2. Culling:
Remove invisible polygons
3. (Perspective) Projection:
Transform Vertices into screen coordinate system
27
4. Clipping:
5. Scan Conversion:
7. Shading:
28
29
30
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
31
32
33
Hardware Rendering
Arbitrary geometries
34
Octrees
Volume Rendering
(See lessons on visualization)
35
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
36
Transformation:
Position und orientation
of objects
Clipping
Shading
37
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
38
39
Translation P = P + D
Rotation P = P * R
Scaling
P = P * S
Shearing P = P * Sh
(D = translation vector)
(R = rotation matrix)
(S = scale matrix)
(Sh = shear matrix)
Inconsistency:
Translation is vector-vector-addition, all other operations are
matrix vector-multiplication
Solution: Homogeneous coordinates Increase dimension
by 1
X , y Y ,z Z
x
P(X,Y,Z,w), with
w
w
w
P(x,y,z)
Convention: w =1
40
Translation Transformation
P P T
T
Tx
Ty
Tz
x x Tx , y y T y , z z Tz
41
Scaling Transformation
P P S
Sx
Sy
Sz
x x S x , y y S y , z z S z
42
Rotation Translation
Rx
Rz
cos
sin
sin
cos
cos
sin
sin
cos
Ry
cos
sin
sin
cos
0 1
Application Transformation
Concatenation of transformations by matrix-matrix-multiplication:
Representation of arbitrary linear transformations by a single matrix
44
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
45
Transformation:
Position und orientation
of objects
Clipping
Shading
46
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
Algorithm Culling
47
48
Computation Culling
N , N 90 N p N 0 cos :
Np N
N
P3
49
Culling Remarks
Compute NPs offline before the simulation starts, or store them with the
model
50
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
51
Transformation:
Position und orientation
of objects
Clipping
Shading
52
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
Definition Projection
General:
A projection is a function from n-dimensional space to (n-1)-dimensional
space
Computer Graphics:
3-D
53
Perspective projection
Parallel projection
is in infinitum
projection
54
eye position
(viewpoint)
55
near
clipping plane
viewing window
far
clipping plane
56
Perspective projection
No diagonal projection: Straight line from the center of projection to
the center of the screen is parallel to the normal vector of the viewing
window
Computation:
View coordinate system
Normal vector of the viewing window is parallel to the z-axis
57
58
xs xv
x d
x
y d
y
z ( ys analog) xs zv z v ( ys zv z v )
d
v
v
v
v
v
d
d
59
z
w v
d
( X Y Z w) xv yv zv 1T
mit
Proj
X xv , Y yv ,
Z zv ,
0
T
Proj 0
0
1
d
0
X
Y
Z
xs , y s , z s d
w
w
w
60
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping will be skipped in this course
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
61
eye position
(viewpoint)
62
near
clipping plane
viewing window
far
clipping plane
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
63
64
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
65
a) Direct reflection
1) Mirror reflection
2) Directed diffuse
(perfect specular reflection) reflection
66
3) Diffuse Reflection
kd , ks , ka
Ii
L
Specular component:
I d I i k d cos I i k d L N I d kd I i ,n Ln N
n
n
n
I s I i k s cos I i k s R V
n: Index for surface roughness
Perfect mirror: n (Ray Tracing: Recursion)
Ambient component:
I g I a ka
Diffuse component:
Overall intensity:
67
I I a k a I i ( k d L N k s R V )
Pictures: Westermann
68
69
Transformation:
Position und orientation
of objects
Clipping
Shading
70
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
1.
Flat Shading
2.
Gouraud Shading
3.
Phong Shading
71
Flat Shading
No interpolation, all inner points of a polygon get the same intensity
Gouraud Shading
(Bilinear) interpolation of the inner points from the vertex intensities
72
done
already
scan line
73
1
I1 ys y2 I 2 y1 ys
y1 y2
1
I1 ys y4 I 4 y1 ys
Ib
y1 y4
Ia
Interpolate intensities for the inner points along the scan line from the
intensities at the intersection points
1
I a xb xs I b xs xa
Is
xb xa
74
75
Phong Shading
Picture: Westermann
76
1
N1 ys y2 N 2 y1 ys
Na
y1 y2
Nb
1
N1 ys y4 N 4 y1 ys
y1 y4
1
N a xb xs N b xs xa
Ns
xb xa
78
Phong Shading
with Specular Highlights
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion will be skipped, but Supersampling!
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
79
Display Resolution
Today:
SXGA, 1280x1024
UXGA, 1600x1200
WUXGA, 1920x1200
See also:
Color depth
Anti-Aliasing
80
1 sample
81
4 samples
16 samples
64SubpixelAufsng
64 Subpixel Auflsung
82
Gewichtung
Radius
83
1
Dr.-Ing. Benjamin Weyers | Virtual Reality & Immersive Visualization | WS 2015/16 |
Course on Data Analysis and Visualization
Transformation:
Position und orientation
of objects
Clipping
Shading
84
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
85
Scientific Visualization
LIC (linear integral convolution)
Imaging in medicine: Render volume by textures
86
87
v
Texel T(u,v)
Texture Map
88
Color
- Functional or procedural
- Randomized
- Photo
Specular and diffuse component
(Environment Mapping)
Transparency ( - Blending)
Perturbation of the normal vector
(Bump Mapping)
89
90
91
92
93
1.
2.
Surface parameterization
Projection (interpolation, see Shading)
Texture Map
Texel T(u,v)
1.
1.a)
Texture Map
Interim Object
Object Space
(xw, yw, zw)
1.b)
2.
Screen
(xs, ys)
Object Space
94
S-Mapping on a Cube
95
1
r
SCylinder : , h u , v 0 , h h0 , with
d
c
0 , h0 : Texture position
c, d : scaling factors
r : Cylinder radius
: 0,2
h : 0, cylinder height
96
T xi , yi , zi Oxw , yw , z w
4 strategies:
1. Intersection point of the surface normal vector at every position
xw , yw , zw and Txi , yi , zi
2. Intersection point of the interim object at every position
3.
4.
97
98
99
Cube Mapping
100
101
102
103
2 extreme situations:
1.
2.
Viewer is very close to the textured object: Only one texel for many
pixels (tiling effect)
Textured object is very far from the viewer: Many texels for only one
pixel (see example on last slide)
ad 1/2.
ad 2.
104
Texture Hierarchies
105
106
107
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
108
109
110
111
Transformation:
Position und orientation
of objects
Clipping
Shading
112
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
Composition
113
Partition
Rendering Pipeline
Representation of rigid objects
Transformations
Culling
Projection
Clipping
Hidden Surface Removal
Shading
Scan Conversion
Texture Mapping
Graphics Hardware
Ray Tracing (optional topic)
114
115
Quality
Speed
Transformation:
Position und orientation
of objects
Clipping
Shading
116
Projection
Hidden Surface
Removal
Scan
Conversion
Transformation:
WKS, SKS
Culling
Root:
Ray optics in physics
(e.g., Descartes)
Occlusion (HSR)
Shadows
Reflection
Refraction
117
118
3-D scene
Objects
(Point) light sources
Eye position
Screen (viewing plane), Pixel
119
120
Shadow Feelers I
121
Shadow Feelers: Rays from the intersection point to the light sources
Calculate intensity at the intersection point (e.g., Phong Reflection
Model)
Shadow Feelers II
122
Reflection
123
Reflection/Deflection
124
Ray Types
shadow feeler
normal vector
view vector
125
reflection vector
transmission vector
Recursion
15
intersection
point 1
14
11
13
10
12
intersection
point 2
5
3
2
9
8
126
intersection
point 3
5
7
10
9
12
11
13
14
15
n=2
n=1
n=4
127
n=3
n=8
CalcImage
{
For (y=0; y<YRES; y++)
{
For (x=0; x<XRES; x++)
{
ViewRay.Start = ViewPoint
ViewRay.Dir = CalcViewDir(x,y,ViewPoint);
Colour = TraceRay(ViewRay,0);
Plot(x,y,Colour);
}
}
}
128
}
129
130
Quality
Speed
Spheres
Planes
Polygons
Polyhedrons
Cubes
Quadrics (cylinders, cones, ellipsoids, ...)
Compound objects
(e.g., Constructive Solid Geometry)
131
Intersections Sphere
PS P0 t D
r
1 xS x0 t xD , yS y0 t yD , zS z0 t z D
2 xS xM 2 yS yM 2 zS zM 2 r 2
P0
1 in 2 :
2
2
2
x0 t xD xM y0 t yD yM z0 t z D zM r 2
A t 2 B t C 0 with
A xD2 y D2 z D2 1 ( D normalized )
B 2 xd x0 xM yd y0 y M z d z0 z M
C x0 xM y0 y M z0 z M r 2
2
132
B B 2 4C
t0 /1
2
Select smaller t
2
If B 4C 0 , the ray misses the sphere
Intersection point:
P x ,y ,z
Normal vector:
133
x0 t xD , y0 t yD , z0 t z D
xS xM y S y M y S y M
NS
,
,
r
r
r
134
Quality
Speed
Reflection coefficients:
Diffuse component:
Specular component:
Ambient component:
Overall intensity:
135
kd , ks , ka
Ii
L
I d I i k d cos I i k d L N I d kd I i ,n Ln N
n
n
n
I s I i k s cos I i k s R V
n: Index for surface roughness
Perfect mirror: n (Ray Tracing: Recursion)
I g I a ka
I I a k a I i ( k d L N k s R V )
}
}
136
S N
S
S N
N
S
S R
Algebraic solution
Geometrical solution
S S
137
SN
N
R / T S N
R S 2N
rf ( S N )
2
2
2
T rf ( S N ) N mit rf 1 S S N
2
Equation 1:
sin S
sin T
sin S
2
sin T
sin 2 T
sin 2 S 2
1 cos
1 cos
S N S N
2 I I 2 I N 2 N N
2 2 cos S 2
T T
1 cos T
S
2
S 2 1 cos 2 T
2
138
Equation 2:
N T 2
N S N 2
N S N N 2
cos S 2
and
insert into
T S N
}
139
140
Quality
Speed
Optimization - Quality
Anti-Aliasing
Supersampling:
141
Anti-Aliasing
Adaptive Supersampling:
142
Optimization - Speed
Ray Traycing is slow!
Standard resolution SXGA (1280x1024): 1.3 Mio pixels
Space subdivision
144
View rays
Rays ending at the same plane (see polygons!)
145
Special hardware for Ray Tracing (e.g., Advanced Rendering Technologies, Cambridge)
Anyway: Ray Tracing may be even faster than traditional shading for scenes with
millions of polygons and a lot of occlusion!
Dr.-Ing. Benjamin Weyers | Virtual Reality & Immersive Visualization | WS 2015/16 |
Course on Data Analysis and Visualization
146
Literature
Foley, van Dam, Feiner, Hughes: Computer Graphics: Principles and Practice. Addison
Wesley, 1992
http://www.gris.informatik.tu-darmstadt.de/lehre/vorl_ueb/gdvII/slides/rr-bw.pdf
147