Projektionen
wie schon immer ...
Computergraphik
Bilderzeugung ?
Computergraphik Welt & Bildmodell
4
Graphics Pipeline
Modeling Transformations
Illumination (Shading) Viewing Transformation (Perspective / Orthographic)
Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display
Output:
Farben / Intensitäten:
Angepasst an den Framebuffer und den Bildschirm (z.B. 24-bit RGB Werte) .
Input:
Geometrische Modelle:
Beschreibung aller Objekte, Oberflächen, Position der Lichtquellen.
Beleuchtungsmodell:
Rechenvorschriften zur Simulation der Interaktion von Materie und Licht Blickwinkel:
Kamera oder Augenposition,
"viewing frustum"
Raster Bereich
"Viewport", Pixelgrid in welches die Bildeben abgebildet wird
Modeling Transformations
3D Modelle haben eigenes Koordinatensystem (object space)
"Modeling transforms" orientieren die Modelle in einem gemeinsamen Koordinatensystem (world space)
Modeling Transformations
Illumination (Shading) Viewing Transformation (Perspective / Orthographic)
Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display
Object space World space
Perspektivische Projektion 3D => 2D
Viewing Transformation
Abbildung der Weltkoordinaten in Kamerakoordinaten.
Blickrichtung wird i.a. in den Ursprung und entlang einer Koordinatenachse gewählt.
Modeling Transformations
Illumination (Shading) Viewing Transformation (Perspective / Orthographic)
Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display
Eye space
World space
8
Betrachten dreidimensionaler Szenen
Ebene geometrische Projektionen: Der Wechsel von 3D Koordinaten zu 2D Bildschirmkoordinaten!
perspektivisch parallel
Der Unterschied zwischen parallel und perspektivischer Projektionen liegt im Abstand des Projektionszentrums (Augpunkt) zur Projektionsebene und zum Objekt.
Parameter einer 3D-Ansicht.
Bild-, Projektions-ebene (viewing plane VP )
Blickpunkt (view reference point VRP) Normale der Bildebene (viewing plane normal VPN) Abstand der Bildebene zum Augpunkt (viewing plane distance VPD) Oben Richtung (viewing up VUP)
Bildschirmmitte (center of window CW) Projektionsrichtung (direction of projection DOP)
Augpunkt (projection referenec point PRP)
Vordere und hinter Clippingebene (front and back plane FP BP)
10
Betrachten dreidimensionaler Szenen (3)
Die Parallel- als auch die perspektivische Projektion werden in viele Projektionstypen aufgespalten.
Parallelprojektionen Perspektivische Projektionen
Rechtwinklig:
Hauptriss
Axionometrische: iso-,di- tri-metrische
Schiefwinklig: Kavalier, Kabinett
1 Punkt , 2Punkt, 3Punkt
Homogene Koordinaten 2D
n.
beschreibe
Punkt selben
den
und obei w
,
y P x
h y x k h
y x h y x y
x
2D Kartesische Koordinaten ---> Homogene Koordinaten
12
Perspektivische Projektion
Projektion von 3D-Koordinaten zu 2D Bildschirmkoordinaten!
z z
x d z z
z x z
x
pz pz
pe pz p
z z y d z z
z y z
y
pz pz
pe pz p
z z
zp p e
(xp,yp,zpe)
z z
z z x x
pz pe pz p
Strahlensatz:
P= (x,y,z) Annahmen:
Augpunkt auf der z-Achse (0,0,zpz)
Projektions Ebene Projektionsebene z-Achse
Zpz Zpe
d = zpz- zpe
Perspektivische Projektion
Homogenen Koordinaten
1 1
h p
h p
perspektiv
h pe
x x x
y y y
h M
z z z
h
0 0 0
0 0 0
0 0
1 1
0 0 1
pz
p p pz
pe pz
pe
pe
pz pz
pz
pz pz
d
z z
x d x
z z
y y
z z
z z
z z z z z
z
z z z z
14
Perspektivische Projektion
Homogenen Koordinaten
1 0 0 0
0 1 0 0
mit 0 0
1 1
0 0
h
pz h pe pz
pe h
pz
x x
z z y z z y
h z
z z
d d d
h z
d d
1 1
h p
h p
perspektiv
h pe
x x x
y y y
h M
z z z
h
Perspektivische Projektion (Sonderfall 1 )
d z d
d z z d z M
pz pz pe pe per
0 1 0
0 0
0 0
1 0
0 0
0 1
Bisherige Annahmen: Augpunkt auf der z-Achse (0,0,zpz), Projektionsebene z-Achse
A) mit zpz= 0 und zpe = -d‘
per
1 0 0 0
0 1 0 0
M' 0 0 1 0
0 0 1 0
' d
' und
'
d d h z
d
16
Perspektivische Projektion
Projiziere alle Punkte entlang der z-Achseauf die z= dEbene, Augpunkt im Ursprung
x y z z / d
=
x y z 1 1
0 0 0
0 1 0 0
0 0 1 1/d
0 0 0 0 x · d / z
y · d / z d 1
=
homogenize
p
d x x
x z z d
p
d y y
y z z d
zp d
Perspektivische Projektion (Sonderfall 2 )
d z d
d z z d z M
pz pz pe pe per
0 1 0
0 0
0 0
1 0
0 0
0 1
Bisherige Annahmen: Augpunkt auf der z-Achse (0,0,zpz),
B) mit zpz= -d‘ und zpe = 0
per
1 0 0 0
0 1 0 0
M' 0 0 0 0
0 0 1 1
' d
' '
und '
d
z h d d
d
Projektionsebene z-Achse
18
Grenzübergang, d → ∞
1 0 0 0
0 1 0 0
0 0 0 1/d
0 0 0 1
1 0 0 0
0 1 0 0
0 0 0 0
0 0 0 1
→
...ist eine
orthographische Projektion diese perspektivische
Projektionsmatrix...
Perspektivische Projektion (allgemein)
mit (0, 0, ) ( , , )
folgt für einen Punkt ' ( ', ', ') auf .
' ' '
pe x y z
x x
y y
pe z pe z
PZ z Q d d d
P x y z S
x Qd x Qd
y Qd t y Qd
z z Qd z z Qd
löse die Gleichungen für ' nach , ' und '
pe p
p p
z z z
t x x y y
( ), 0 1
P Z t P P Z t
Ppliegt auf der Strecke Szwischen PZund P
P= (x,y,z) Annahmen:
Augpunkt auf der z-Achse (0,0,zpz)
Projektions- Ebene
Pp=(xp,yp,zpe)
(0,0,zpe) PZ
Projektionsebene z-Achse
Q (dx,dy,dz) PZ
20
Perspektivische Projektion (allgemein)
' (1)
' (2)
' (3)
x x
y y
p z p z
x Qd x Qd
y Qd t y Qd
z z Qd z z Qd
P= (x,y,z)
Projektions- Ebene
Pp=(xp,yp,zp)
(0,0,zp) Q
(dx,dy,dz) PZ
z 1
) 2 ( in ) 3 (
p
z
z y p z y p
Qd z
d z d d z d y y
für ' (3)
p
p p z
p z
z z
z z Qd
t z z Qd
, z 1
(1) in ) 3 (
p
z
z x p z x p
Qd z
d z d d zd x x
Perspektivische Projektion (allgemein)
z 1
p
z
z y p z y p
Qd z
d z d d zd y y
, z 1
p
z
z x p z x p
Qd z
d z d d zd x x
p
p
z 1
z
z 1
z
p p
z
z z Qd
z Qd
p
p
z 1
z
z 1
z
p p
z
z z Qd
z Qd
per ?
M
z 1 h 1
p
Qdz
z
2
1 0
0 1
0 0
0 0 1 1
x x
p
z z
y
p
z z
per
p p
p
z z
p
z z
d d
d z d
d dy
d z d
M z z
Qd Qd z z
Qd Qd
2
1 0
0 1
0 0
0 0 1 1
x x
p
z z
y
p
z z
p p
p
z z
p
z z
d d
d z d
d dy
d z d
z z
Qd Qd z z
Qd Qd
22
Perspektivische Projektion (allgemein)
1 1 0 0
0 0
1 0
0 1
allgemein 2
z p z
p z p z
p
z y p z
y
z x p z
x
Qd z Qd
Qd z z Qd
z
d z d d
d
d z d d
d
M
Zp Q [ dx dy dz ]
0 0 -1
0
o r t
M
0 0 -1
d d
p e r
M
0 0 -1
d 0 'p e r M
Parallel Projektion
1 1 0 0
0 0
1 0
0 1
allgemein 2
z p z
p z p z
p
z y p z
y
z x p z
x
Qd z Qd
Qd z z Qd
z
d z d d
d
d z d d
d
M
Zp Q [ dx dy dz ]
c o s s in -1
0
C a v a lie r
1 - 2 s in 2 cos 0
Cabinet
24
Was ist falls p
z≤ Auge
zist ?
(eyex, eyey, eyez)
image plane z axis
Was ist falls p
z≤ Auge
zist ?
(eyex, eyey, eyez)
image plane z axis
26
Was ist falls p
z≤ Auge
zist ?
(eyex, eyey, eyez)
image plane z axis
Was ist falls p
z≤ Auge
zist ?
(eyex, eyey, eyez)
image plane z axis
???
28
Was ist falls p
z≤ Auge
zist ?
(eyex, eyey, eyez)
image plane z axis
Ausweg: beschränken der Geometrie auf das " view
frustum"
Projektionen der "pipeline"?
Modeling Transformations
Illumination (Shading) Viewing Transformation (Perspective / Orthographic)
Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display
Camera /eye Space
Normalized Device Coordiantes
Screen Space
30
Normalizing the Viewing Volume
2 0 0 0
2
0 0 0
2
0 0 0
0 0 0 1
1 0 0
0 1 0
0 0 1
0 0 0 1
2 2
2
1 1
normalized normalized normalized
r l
t b
n f
l r b t
n f
x x
y y
z z
Orthographic viewing volume:
x = l:=left plane x = r:=right plane y = b :=bottom plane y = t:= top plane z = n:=near plane z = f:= far plane
Orthographic Projection
1 1 1
pixel normalized
pixel normalized
sreeen o
normalized normalized
x x x
y y y
M M
z z z
2 0 0 0
0 2 0 0
0 0 2 0
0 0 0 1
1 0 0
0 1 0
0 0 1
0 0 0 1
2 2 2
1 1
pixel pixel
screen normalized
r l
r b
r f
l r b t n f
x x
y y
z M z
2 0 0 0
0 0
2 2
0 2 0 0
0 0
2 2
2
0 0 0
0 0 1 0
0 0 0 1
0 0 0 1
1 1 0 0
1 0 1 0
0 0 1
0 0 0 1
2 2 2
1 1
x x
pixel
y y
pixel normalized
n n
r l
n n
r b
r f
l r b t n f
x x
y y
z z
32
Viewing Transformation
Welt Koordinaten → Kamera koordinaten
Positionieren der Kamera
Translation + Änderung der orthonormal Basis Gegeben:
Koordinatenxyz& uvn, und der Punkt p= (x,y,z) Finde:
p= (u,v,w) x
y v
u x p
y u
v
- w
Viewing Transformation
Positionieren der Kamera
Gegeben:
Koordinatenxyz& uvw, e und der Punkt p= (x,y,z) Finde:
p= (u,v,w)
v
0 1 0 0
0 0 1 0
M
0 0 0 1
0 0 0 1 0 0 0 1 1
x y z x
x y z y
x y z z
u u u e x
v v v e y
w w w e z
34
Full orthoraphic projection pipeline
compute: Mv
compute: Mo M = Mo Mv
Foreach line segment ( ai, bi ) do p = M ai
q = M bi
draw line (xp, yp, xq, yq)
Perspective Projection
'
'
'
1
P
h x x
h y y
h z M z
h
P
1 0 0 0
0 1 0 0
0 0
0 0 1 0
n f
M f
n n
36
Full perspective projection pipeline
compute: Mv compute: Mo compute: MP
M = Mo MPMv
Foreach line segment ( ai, bi ) do p = M ai
q = M bi
draw-line ( xp/hp, yp/hp, xq/hq, yq/hq)
Mo MP is often called theprojection matrix
The openGL projection Matix
Mo MP is often called theprojection matrix
openGL
2
2
2
0 0
0 0
M
0 0
0 0 1 0
n r l
r l r l
n t b
t b t b
f n fn
f n f n
38
Graphics Pipeline
Effizientes Clipping wird NICHT in einem einzelne Prozessschritt durchgeführt!
Modeling Transformations
Illumination (Shading) Viewing Transformation (Perspective / Orthographic)
Clipping Projection (to Screen Space) Scan Conversion (Rasterization) Visibility / Display
Full Clipping
(eyex, eyey, eyez)
image plane z axis
"clip" geometry to view frustum
40
Front- & Backplane clipping
(eyex, eyey, eyez)
image plane z axis
"clip" geometry to near plane
Tiefenspeicher ( z-buffer algorithm 1974 )
Für jeden Rasterpunkt x,ywird zusätzlich, außer dem BildspeicherB(x,y) der die Farbintensitäten i speichert, noch ein Tiefenspeicher T(x,y)für z(x,y)angelegt (16 - 32 bit).
1.) Initialisieren: für alle x,y
B(x,y)= Hintergrundfarbe
T(x,y)= Zmax (maximal vom Beobachter entfernt).
2.) Alle Objekte rendern ( rastern, scanline-konvertieren) z(x,y)berechnen;
nur falls z(x,y) < T(x,y)
==> T(x,y)= z(x,y) und B(x,y)= i (x,y)
Wolfgang Strasser, in seiner Habilitationschrift (1974) erster Hinweis auf Z-buffer Methodik.