Viewing. Doug James’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals of Computer Graphics, Chap 7. Wen-Chieh (Steve) Lin Institute of Multimedia Engineering. Getting Geometry on the Screen. Given geometry in the world coordinate system, how do we get it to the display?
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Viewing
Doug James’ CG Slides, Rich Riesenfeld’s CG Slides,
Shirley, Fundamentals of Computer Graphics, Chap 7
Wen-Chieh (Steve) Lin
Institute of Multimedia Engineering
Given geometry in the world coordinate system, how do we get it to the display?
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
glMatrixMode(GL_MODELVIEW)
glMatrixMode(GL_PROJECTION)
glViewport(…)
ILE5014 Computer Graphics 10F
glMatrixMode(GL_MODELVIEW)
gluLookAt(…)
glMatrixMode(GL_PROJECTION)
glFrustrum(…)
gluPerspective(…)
glOrtho(…)
glViewport(x,y,width,height)
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
F
P
ILE5014 Computer Graphics 10F
Image
W
F
I
World
ILE5014 Computer Graphics 10F
Image
W
Image
F
I
F
World
World
Camera lens
Note: Since we don't want the image to be inverted, from now on we'll put F behind the image plane.
ILE5014 Computer Graphics 10F
World
Image
F
ILE5014 Computer Graphics 10F
front
side
top
ILE5014 Computer Graphics 10F
orthographic projection
perspective projection
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
y
(1,1)
x
x
(nx, ny)
(-1,-1)
y
Screen
Image Plane
ILE5014 Computer Graphics 10F
translation
scale
reflection
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
y
x
vup
y
z
x
y
lookfrom
x
z
START HERE
z
w
Translate LOOKFROM
to the origin
Rotate the view vector
(lookfrom - lookat) onto
the z-axis.
y
x
Multiply by the projection matrix and everything will be in the canonical camera position
z
Rotate about z to bring vup to y-axis
ILE5014 Computer Graphics 10F
y
x
vup
y
z
x
lookfrom
z
START HERE
w
Translate LOOKFROM
to the origin
ILE5014 Computer Graphics 10F
y
x
y
x
z
z
Translate LOOKFROM
to the origin
Rotate the view vector
(lookat -lookfrom) onto
the z-axis.
y
x
z
Rotate about z to bring vup to y-axis
ILE5014 Computer Graphics 10F
v
y
x
z
w
w: lookat – lookfrom
v: view up direction
u = v x w
ILE5014 Computer Graphics 10F
In global coord. (xp,yp)
In local coord. (up,vp)
ILE5014 Computer Graphics 10F
?
w
v
u
Z
P
e
Y
?
X
ILE5014 Computer Graphics 10F
w
v
Z
u
P
Y
e
local coordinate
world coordinate
X
ILE5014 Computer Graphics 10F
Given 3D geometry (a set of points a)
ILE5014 Computer Graphics 10F
Image plane
Center of projection
ILE5014 Computer Graphics 10F
view plane
y
ys
g
e
d
z
e: eye position
g: gaze direction
ILE5014 Computer Graphics 10F
Divide by 4th coordinate
(the “w” coordinate)
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
ILE5014 Computer Graphics 10F
vanishing point
ILE5014 Computer Graphics 10F
Given 3D geometry (a set of points a)
ILE5014 Computer Graphics 10F
Given 3D geometry (a set of points a)
ILE5014 Computer Graphics 10F