Download presentation
Presentation is loading. Please wait.
1
Projection and Clipping
網媒所林宏祥 Self introduction Why I am here in lecture The lecture will cover projection and clipping, the remaining time is any open question about homework 1
2
Overview Overview of the content: orthogonal projection, perspective projection, and viewing volume
3
Orthogonal Projection
X xviewport xcamera -Z Ask whether the student know viewport coordinates? Orthogonal projection: the focal point is at infinity
4
Perspective Projection
X xcamera xviewport -Z d z The distance between focal point and image plane is d
5
View Volume—orthogonal projection
y -z x Far Clipping Plane Left Clipping Plane Right Clipping Plane Bottom Clipping Plane Top Clipping Plane Finite visual field Orthogonal projection+finite visual field = cuboid Near Clipping Plane
6
View Volume—Perspective projection model
y -z x Left Clipping Plane Far Clipping Plane Top Clipping Plane Near Clipping Plane Bottom Clipping Plane Right Clipping Plane
7
Y x z Clipping Cuboid: transformed volume after projection
viewport coordinates x This is cuboid on viewport coordinates z
8
Implementation behind OpenGL Functions….
9
In OpenGL, the clipping cuboid is fixed.
(Since the screen size is fixed)
10
Y x z Clipping Cuboid: enclosed by:
xviewport = 1,xviewport=-1,yviewport=1,yviewport=-1,zviewport =1,zviewport=-1 Y x z
11
The openGL functions ensure the view volume fits clipping cuboid.
12
glOrtho(left, right, bottom, top, nearVal, farVal)
13
glOrtho(left, right, bottom, top, nearVal, farVal)
14
Orthogonal Projection
X xviewport xcamera -Z some scaling
15
A linear mapping for orthogonal projection
16
A canonical view.. Clipping cuboid Viewing Volume 1 -1 left right
xviewport xcamera
17
Same mapping ways in y direction and z direction..
18
gluPerspective(fovy, aspect, zNear, zFar)
Left Clipping Plane Far Clipping Plane Top Clipping Plane Near Clipping Plane Bottom Clipping Plane Right Clipping Plane
19
gluPerspective(fovy, aspect, zNear, zFar)
20
Perspective Projection
X X xcamera xcamera xviewport xviewport -Z -Z d d = 1 z z some scaling
21
A canonical view.. Y -zFar -zNear ycamera fovy zcamera -Z
22
Y -zFar -zNear ycamera fovy zcamera -Z
23
Y -zFar -zNear ycamera fovy zcamera -Z After projection, the boundaries should map to 1, -1
24
Similarly in x, but consider the aspect.
25
Mapping on z: To present more details in closer objects, the viewport coordinate is inverse proportional to camera coordinates.
26
-zFar is mapping to 1, -zNear is mapping to -1, then
28
Remember perspective projection?
(xcamera, ycamera coordinates will be divided by zcamera)
29
Perspective projection <--> maintaining homogeneous coordinates
30
In the clipping part of your homework..
31
You need to adjust the coordinates in glVertex3f()
You need to create your own clipping cuboid which is different from openGL clipping cuboid. NOT modify the viewing volume. (eg: xviewport: [-0.5,0.5], yviewport:[-0.5,0.5], zviewport:[-0.5, 0.5]) You need to adjust the coordinates in glVertex3f()
32
You need to calculate intersection
In 2D example, screen One capable way to handle it: Cohen-Sutherland Algorithm
33
Any Question?
34
From normalized device coordinates to screen coordinates
glViewport(x, y, w,h)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.