0% found this document useful (0 votes)
7 views27 pages

Lecture14a Viewing3D Projections I

The document discusses the concepts of viewing in 3D, focusing on the transformation pipeline, viewing coordinate systems, and various types of projections including orthographic, perspective, and oblique projections. It explains how to specify viewing coordinates, the mathematical transformations involved, and the differences between parallel and perspective projections. Additionally, it covers the implications of different projection types on the representation of 3D objects on 2D displays.

Uploaded by

Iqra Suhana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views27 pages

Lecture14a Viewing3D Projections I

The document discusses the concepts of viewing in 3D, focusing on the transformation pipeline, viewing coordinate systems, and various types of projections including orthographic, perspective, and oblique projections. It explains how to specify viewing coordinates, the mathematical transformations involved, and the differences between parallel and perspective projections. Additionally, it covers the implications of different projection types on the representation of 3D objects on 2D displays.

Uploaded by

Iqra Suhana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Viewing in 3D

Foley & Van Dam, Chapter 6


Viewing in 3D
• Transformation Pipeline
• Viewing Plane
• Viewing Coordinate System
• Projections
• Orthographic
• Perspective
OpenGL Transformation Pipeline
Homogeneous coordinates
in World System

ModelView
ModelViewMatrix
Matrix
Viewing
Coordinates
Projection
ProjectionMatrix
Matrix
Clip
Coordinates
Clipping
Clipping

Viewport
ViewportTransformation
Transformation

Window Coordinates
Viewing Coordinate System
zw
world

xw yw
Tractor
System Viewer
System

yv
Front- xv
Wheel
System P0
zv

ne
pl a
i n g
i ew
V
Specifying the Viewing Coordinates
• Viewing Coordinates system, [xv, yv, zv],
describes 3D objects with respect to a viewer

• A viewing plane (projection plane) is set up


perpendicular to zv and aligned with (xv,yv)

• In order to specify a viewing plane we have


to specify:
• a vector N normal to the plane
• a viewing-up vector V
• a point on the viewing plane
Specifying the Viewing Coordinates

zw
v yv
P
xv
N
P0
zv
yw
xw la ne
g p
w in
V ie
• P0=(x0,y0,z0) is the point where a camera is located
• P is a point to look-at
• N=(P0-P)/|P0-P| is the view-plane normal vector
• V=zw is the view up vector, whose projection onto
the view-plane is directed up
Viewing Coordinate System
V × N
zv = N ; xv = ; yv = zv × xv
V × N
• The transformation M, from world-coordinate into
viewing-coordinates is:
 x 1
v x 2
v x 3
v 0  1 0 0 − x 0 
   
y 1
y 2
y 3
0  0 1 0 − y
M =  v v v 0  = R ⋅T
 z 1
z 2
z 3
0  0 0 1 − z 0 
v v v
   
 0 0 0 1   0 0 0 1 

• Defining the camera in OpenGL:


glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(P0x, P0y, P0z, Px, Py, Pz, Vx, Vy, Vz);
Projections
• Viewing 3D objects on a 2D display requires a
mapping from 3D to 2D

• A projection is formed by the intersection of certain


lines (projectors) with the view plane

• Projectors are lines from the center of projection


through each point in the object
Center of
Projection
Projections
• Center of projection at infinity results with a parallel
projection

• A finite center of projection results with a


perspective projection
Projections
• Parallel projections preserve relative proportions of
objects, but do not give realistic appearance
(commonly used in engineering drawing)
• Perspective projections produce realistic
appearance, but do not preserve relative proportions

Perspective Projection
Parallel Projection
• Projectors are all parallel
• Orthographic: Projectors are perpendicular
to the projection plane
• Oblique: Projectors are not necessarily
perpendicular to the projection plane

Orthographic Oblique
Orthographic Projection
Since the viewing plane is aligned with (xv,yv),
orthographic projection is performed by:
 x p   xv  1 0 0 0   x v

 y p
  y  0
 =  v  =  1 0 0  
 y v 
 0   0  0 0 0 0   zv 
       
 1   1  0 0 0 1   1 

(x,y,z) (x,y)
yv
xv
P0
zv
Orthographic Projection
• Lengths and angles of faces parallel to the
viewing planes are preserved
• Problem: 3D nature of projected objects is
difficult to deduce Top
View

Fro i e w
nt eV
vi e
w Sid
Oblique Projection
• Projectors are not perpendicular to the
viewing plane
• Angles and lengths are preserved for faces
parallel to the plane of projection
• Preserves 3D nature of an object

yv (xp,yp)
xv
(x,y,z)
(x,y)
Oblique Projection
•Two types of oblique projections are
commonly used:
– Cavalier: α=45ο =tan−1(1)
– Cabinet: α=tan-1(2) ≈63.4ο
yv

(xp,yp)

α
b
a xv
(x,y,z) φ
(x,y,1)
(x,y)
Oblique Projection
 x p  1 0 a cos φ 0 xv   x v + z v a cos φ 
 y p  0 1 a sin φ 0 yv   y + z a sin φ 
  =    =  v v 
 0  0 0 0 0 zv   0 
 1  0 0 0 1   1   1 
     

yv
1/a=tan(α)
z/b= 1/a (xp,yp)
b=za
α
b
xp=z⋅a⋅cos(φ)
a xv
yp=z⋅a⋅sin(φ) (x,y,z) φ
(x,y,1)
(x,y)
Oblique Projection
1 1
1 1

1 1
φ=45o φ=30o

Cavalier Projections of a cube


for two values of angle φ

0.5 1 0.5
1

1 1
φ=45o φ=30o

Cabinet Projections of a cube


for two values of angle φ
Oblique Projection
• Cavalier projection :
– Preserves lengths of lines perpendicular
to the viewing plane
– 3D nature can be captured but shape
seems distorted
– Can display a combination of front, side,
and top views
• Cabinet projection:
– Lines perpendicular to the viewing plane project
at 1/2 of their length
– A more realistic view than the Cavalier
projection
– Can display a combination of front, side, and top
views
Perspective Projection
• In a perspective projection, the center of projection
is at a finite distance from the viewing plane
• The size of a projected object is inversely
proportional to it distance from the viewing plane
• Parallel lines that are not parallel to the viewing
plane, converge to a vanishing point
• A vanishing point is the projection of a point at
infinite distance
Z-axis
y vanishing point

z
Perspective Projection
Vanishing Points
• There are infinitely many general vanishing
points
• There can be up to three principal vanishing
points (axis vanishing points)
• Perspective projections are categorized by
the number of principal vanishing points, equal
to the number of principal axes intersected by
the viewing plane
• Most commonly used: one-point and two-
points perspective
Vanishing Points
y

One point (z axis) perspective projection

x axis z axis
vanishing point vanishing point

Two points
perspective projection
Perspective Projection
(x,y,z)
(xp,yp,0)

d y
center of x
projection x (x,y,z)
z xp

d z
• Using similar triangles it follows:
xp x yp y
= ; =
d z+d d z+d
d ⋅x d⋅y
xp = ; yp = ; zp = 0
z+d z+d
Perspective Projection
Thus, a perspective projection matrix is defined as:
1 0 0 0 
0 1 0 0 

M per = 0 0 0 0 
 1 
0 0 1 
 d 

1 0 0 0   x   x 
0 1 0 0     y 
  y   
M per P = 0 0 0 0  =  0 
z 
 1   z + d 
0 0 1   
1   
 d    d 

d ⋅x d ⋅y
xp = ; y p = ; z p = 0
z + d z + d
Perspective Projection
• Mper is singular (|Mper|=0), thus Mper is a many to
one mapping (for example: MperP=Mper2P)
• Points on the viewing plane (z=0) do not change
• The homogeneous coordinates of a point at infinity
directed to (Ux,Uy,Uz) are (Ux,Uy,Uz,0). Thus, The
vanishing point of parallel lines directed to (Ux,Uy,Uz)
is at [dUx/Uz, dUy/Uz]

• When d→∞, Mper →Mort


Projections
What is the difference between moving the center of
projection and moving the projection plane?
Original

Center of Projection z
Projection plane
Moving the Center of Projection

Center of Projection z
Projection plane
Moving the Projection Plane

Center of Projection z
Projection plane
Projections
Planar geometric
projections

Parallel Perspective

Oblique Orthographic One point


Front
Top Two point
Cavalier
Side Other
Cabinet
Other Three point

You might also like