http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005 - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005

Description:

Projections II Week 4, Wed Jan 26 http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005 – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 44
Provided by: ubc92
Category:
Tags: angles | camera | cs314 | http | ubc | ugrad | vjan2005 | www

less

Transcript and Presenter's Notes

Title: http://www.ugrad.cs.ubc.ca/~cs314/Vjan2005


1
Projections IIWeek 4, Wed Jan 26
  • http//www.ugrad.cs.ubc.ca/cs314/Vjan2005

2
Reading (Mon and today)
  • FCG
  • Section 5.3.1
  • rest of Chapter 6
  • RB
  • rest of Chapter Viewing
  • rest of Appendix Homogeneous Coords

3
Review Graphics Cameras
  • real pinhole camera image inverted

eye point
image plane
  • computer graphics camera convenient equivalent

eye point
center of projection
image plane
4
Review Basic Perspective Projection
similar triangles
P(x,y,z)
y
P(x,y,z)
z
zd
homogeneous coords
5
Review Orthographic Cameras
  • center of projection at infinity
  • no perspective convergence
  • just throw away z values

6
Review Transforming View Volumes
NDCS
y
(1,1,1)
z
(-1,-1,-1)
x
7
Review Ortho to NDC Derivation
  • scale, translate, reflect for new coord sys

VCS
ytop
xleft
y
z
xright
x
z-far
ybottom
z-near
8
NDC to Viewport Transformation
  • generate pixel coordinates
  • map x, y from range 11 (NDC) to pixel
    coordinates on the display
  • involves 2D scaling and translation

y
display
x
viewport
9
NDC to Viewport Transformation
  • 2D scaling and translation

(1,1)
(w,h)
DCS
b
NDCS
a
y
  • (-1,-1)

x
(0,0)
OpenGL
glViewport(x,y,a,b)
default
glViewport(0,0,w,h)
10
Origin Location
  • yet more possibly confusing conventions
  • OpenGL lower left
  • most window systems upper left
  • often have to flip your y coordinates
  • when interpreting mouse position

11
Perspective Example
view volume left -1, right 1 bot -1,
top 1 near 1, far 4
tracks in VCS left x-1, y-1 right
x1, y-1
x1
x-1
1
ymax-1
z-4
realmidpoint
-1
z-1
1
-1
xmax-1
0
-1
0
x
NDCS (z not shown)
DCS (z not shown)
z
VCStop view
12
Viewing Transformation
y
image plane
VCS
z
OCS
z
y
Peye
y
x
x
WCS
object
world
viewing
VCS
OCS
WCS
OpenGL ModelView matrix
13
Projective Rendering Pipeline
object
world
viewing
alter w
WCS
VCS
OCS
projection transformation
clipping
/ w
CCS
perspective division
normalized device
  • OCS - object coordinate system
  • WCS - world coordinate system
  • VCS - viewing coordinate system
  • CCS - clipping coordinate system
  • NDCS - normalized device coordinate system
  • DCS - device coordinate system

NDCS
device
DCS
14
Projective Rendering Pipeline
object
world
viewing
alter w
WCS
VCS
OCS
projection transformation
clipping
/ w
CCS
perspective division
normalized device
  • OCS - object coordinate system
  • WCS - world coordinate system
  • VCS - viewing coordinate system
  • CCS - clipping coordinate system
  • NDCS - normalized device coordinate system
  • DCS - device coordinate system

NDCS
device
DCS
15
Perspective Projection
  • specific example
  • assume image plane at z -1
  • a point x,y,z,1T projects to -x/z,-y/z,-z/z,1T
    ?
  • x,y,z,-zT

-z
16
Perspective Projection
projection transformation
perspective division
alter w
/ w
17
Canonical View Volumes
  • standardized viewing volume representation
  • orthographic
    perspective
  • orthogonal
  • parallel

x or y /- z
x or y
x or y
backplane
backplane
1
frontplane
FrontPlane
-z
-z
-1
-1
18
Why Canonical View Volumes?
  • permits standardization
  • clipping
  • easier to determine if an arbitrary point is
    enclosed in volume
  • consider clipping to six arbitrary planes of a
    viewing volume versus canonical view volume
  • rendering
  • projection and rasterization algorithms can be
    reused

19
Projection Normalization
  • one additional step of standardization
  • warp perspective view volume to orthogonal view
    volume
  • render all scenes with orthographic projection!

x
x
zd
zd
z0
z?
20
Predistortion
21
Perspective Normalization
  • perspective viewing frustum transformed to cube
  • orthographic rendering of cube produces same
    image as perspective rendering of original frustum

22
Demos
  • Tuebingen applets from Frank Hanisch
  • http//www.gris.uni-tuebingen.de/projects/grdev/do
    c/html/etc/AppletIndex.htmlTransformationen

23
Perspective Warp
  • matrix formulation
  • preserves relative depth (third coordinate)
  • what does mean?

24
Projection Normalization
normalized device
clipping
viewing
CCS
VCS
NDCS
projection transformation
perspective division
alter w
/ w
  • distort such that orthographic projection of
    distorted objects is desired persp projection
  • separate division from standard matrix multiplies
  • clip after warp, before divide
  • division normalization

25
Projective Rendering Pipeline
glVertex3f(x,y,z)
object
world
viewing
alter w
WCS
VCS
OCS
glFrustum(...)
projection transformation
clipping
glTranslatef(x,y,z) glRotatef(th,x,y,z) ....
gluLookAt(...)
/ w
CCS
perspective division
normalized device
  • OCS - object coordinate system
  • WCS - world coordinate system
  • VCS - viewing coordinate system
  • CCS - clipping coordinate system
  • NDCS - normalized device coordinate system
  • DCS - device coordinate system

glutInitWindowSize(w,h) glViewport(x,y,a,b)
NDCS
device
DCS
26
Coordinate Systems
http//www.btinternet.com/danbgs/perspective/
27
Perspective Derivation
VCS
NDCS
ytop
y
xleft
(1,1,1)
y
z
(-1,-1,-1)
x
z
z-near
ybottom
z-far
x
xright
28
Perspective Derivation
earlier
complete shear, scale, projection-normalization
29
Perspective Derivation
30
Perspective Derivation
  • similarly for other 5 planes
  • 6 planes, 6 unknowns

31
Perspective Example
  • view volume
  • left -1, right 1
  • bot -1, top 1
  • near 1, far 4

32
Perspective Example
/ w
33
Asymmetric Frusta
  • our formulation allows asymmetry
  • why bother?

x
x
right
right
Frustum
Frustum
-z
-z
left
left
z-n
z-f
34
Simpler Formulation
  • left, right, bottom, top, near, far
  • nonintuitive
  • often overkill
  • look through window center
  • symmetric frustum
  • constraints
  • left -right, bottom -top

35
Field-of-View Formulation
  • FOV in one direction aspect ratio (w/h)
  • determines FOV in other direction
  • also set near, far (reasonably intuitive)

x
w
fovx/2
h
Frustum
-z
?
fovy/2
z-n
z-f
36
Perspective OpenGL
glMatrixMode(GL_PROJECTION) glLoadIdentity() gl
Frustum(left,right,bot,top,near,far)
or glPerspective(fovy,aspect,near,far)
37
Demo Frustum vs. FOV
  • Nate Robins tutorial (take 2)
  • http//www.xmission.com/nate/tutors.html

38
Projection Taxonomy
planar projections
perspective 1,2,3-point
parallel
orthographic
oblique
cavalier
cabinet
axonometric isometric dimetric trimetric
top, front, side
http//ceprofs.tamu.edu/tkramer/ENGR20111/5.1/20
39
Perspective Projections
  • classified by vanishing points

two-point perspective
three-point perspective
40
Parallel Projection
  • projectors are all parallel
  • vs. perspective projectors that converge
  • orthographic projectors perpendicular to
    projection plane
  • oblique projectors not necessarily perpendicular
    to projection plane

Oblique
Orthographic
41
Axonometric Projections
  • projectors perpendicular to image plane
  • select axis lengths

http//ceprofs.tamu.edu/tkramer/ENGR20111/5.1/20
42
Oblique Projections
  • projectors oblique to image plane
  • select angle between front and z axis
  • lengths remain constant
  • both have true front view
  • cavalier distance true
  • cabinet distance half

d / 2
y
y
d
d
d
x
z
x
z
cabinet
cavalier
43
Demos
  • Tuebingen applets from Frank Hanisch
  • http//www.gris.uni-tuebingen.de/projects/grdev/do
    c/html/etc/AppletIndex.htmlTransformationen
Write a Comment
User Comments (0)
About PowerShow.com