Escolar Documentos
Profissional Documentos
Cultura Documentos
Projections
Taxonomy
Parallel
orthographic
oblique
Perspective
1-pt
2-pt
3-pt
The University of Texas at Austin
Parallel Projections
x
1
y
= 0
z
0
1
0
0
1
0
0
0
0
0
0
0
x
0
y
0 z
1
1
Perspective Projection
y
(0,0)
Projection plane, z = n
(1, 1, 1)
viewing frustum
t
r
[-(r-l)/2,(t-b)/2,-n]
b
(t+b)/2
z
n
x
(r+l)/2
f
x
viewing frustum
[(r-l)/2,-(t-b)/2,-n]
After applying the modelview matrix, we are looking down the z axis.
We need to move the ray from the origin through the window center onto the z axis.
Rotation wont do since the window wouldnt be orthogonal to the z axis.
Translation wont do since we need to keep the eye at the origin.
The University of Texas at Austin
10
x
1
y
= 0
z
0
1
0
r+l
z
2n
t+b
y+
z
2n
x+
0
1
0
0
r+l
2n
t+b
2n
1
0
0
x
0
y
0 z
1
1
11
For ease of clipping, we want the oblique clipping planes to have equations x = z and
y = z .
This will make the window square, with boundaries l = b = n and r = t = n.
This requires a scale to make the window this size.
y
[-(r-l)/2,(t-b)/2,-n]
[-n,n,-n]
z
x
[(r-l)/2,-(t-b)/2,-n]
[n,-n,-n]
12
2nx
rl
2ny
tb
z
or in matrix form:
2n
rl
y
0
=
z
0
1
0
0
2n
tb
0
0
0
0
1
0
0
0
0
1
13
Combining the three steps given above, the complete OpenGL perspective matrix generated
by the call glFrustum(l, r, b, t, n, f )
2n
rl
0
0
1
0
0
0
0
1
0
0
0
0
0
0
(f +n)
f n
2f n
f n
0
2n
tb
0
0
r+l
rl
t+b
tb
(f +n)
f n
2f n
f n
2n
rl
0
0
0
2n
tb
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
r+l
2n
t+b
2n
1
0
0
0
0
1
14
Combining the three steps given above, the complete OpenGL orthographic matrix generated
by the call glOrtho(l, r, b, t, n, f )
2
rl
0
0
1
0
0
0
0
1
0
0
0
0
0
0
(f +n)
f n
2f n
f n
0
2
tb
0
0
r+l
rl
t+b
tb
+n)
(ff n
1
0
0
2
f n
0
2n
rl
0
0
0
2n
tb
0
0
0
0
1
0
0
0
0
1
0
1
0
0
r+l
2n
t+b
2n
1
0
0
0
0
1
15
Note that
n
tb
= cot
near plane
viewing frustum
cot 2
x aspect
16
cot 2
x
0
aspect
y
=
0
cot 2
0
0
1
0
0
0
0
1
0
x
0
0 y
z
0
1
1
17
and set_view_up(vup_x,vup_y,vup_z)
18
glMatrixMode (GL_MODELVIEW);
gluLookAt(0,0,0, 0,0,-1, 0,1,0);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glFrustum(-1, 1, -1, 1, 2, 7);
glMatrixMode (GL_MODELVIEW);
glutSolidTeapot(1);
glMatrixMode (GL_MODELVIEW);
gluLookAt(0,0,0, 0,0,-1, 1,1,0);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glFrustum(-3, 1, -3, 1, 2, 7);
glMatrixMode (GL_MODELVIEW);
glutSolidTeapot(1);
19
Before the next class please review Chapter 4 and its practice exercises, of the recommended
text.
(Recommended Text: Interactive Computer Graphics, by Edward Angel, Dave Shreiner, 6th
edition, Addison-Wesley)
Please track Blackboard for the most recent Announcements and Project postings related to
this course.
(http://www.cs.utexas.edu/users/bajaj/graphics2012/cs354/)
20