3D Viewing Transformation

3D Viewing
Projections
A
Projectors
A’
B
B’
Center of
Projection
Projection Plane
Perspective
3D Viewing
Projections
A
Projectors
A’
B
B’
At Infinity
Projection Plane
Parallel
3D Viewing
Parallel Projections
Orthographic
Top View
Y
Z
X
Front View
Side View
3D Viewing
Parallel Projections
Orthographic
• Multiviews
(x=0 or y=0 or z=0 planes),
one View is not adequate
• True size and shape for lines
On z=0 plane
 1 0 0 0
0 1 0 0

P =
0 0 0 0
0 0 0 1


3D Viewing
Parallel Projections
Orthographic
3D Viewing
Parallel Projections
Axonometric
• Additional rotation,translation and then
projection on z=0 plane
 1 0 0 1
[U ][T ] = 0 1 0 1 [T ] =
0 0 1 1
fx =
x x* 2 + y x* 2 ; f y =
 x x*
 *
xy
 x z*

y x*
y y*
y z*
x y* 2 + y y* 2 ; fz =
0 1

0 1
0 1
x z* 2 + y z* 2
3D Viewing
Parallel Projections
Axonometric
Three types
• Trimetric: No foreshortening is the same.
• Dimetric: Two foreshortenings are the same.
• Isometric: All foreshortenings are the same.
3D Viewing
Parallel Projections
Axonometric
Trimetric
f x ≠ f y ≠ fz
Dimetric
fy = fz
Isometric
f x = f y = fz
3D Viewing
Parallel Projections
Isometric
Let there be 2 rotations a) about y-axis φ
b) about x-axis θ
cos ö
 0
T =
 sin ö
 0

0 − sin ö
1
0
0
0
cos ö
0
0  1
0
0
0  1 0 0
0 0 cos è sin è 0 0 1 0


0 0 − sin è cos è 0 0 0 0
1 0
0
0
1 0 0 0
0
0

0
1
3D Viewing
Parallel Projections
Isometric
Let there be 2 rotations a) about y-axis φ
b) about x-axis θ
cos ö
 0
T =
 sin ö
 0

sin ö sin è
cos è
− cos ö sin è
0
0 0
0 0

0 0
0 1
3D Viewing
Parallel Projections
Isometric
sin ö sin è
 cos ö
 1 0 0 1 
0
cos è



[U ][T ] =  0 1 0 1
 sin ö − cos ö sin è
 0 0 1 1 
0
 0
sin ö sin è
0 1
 cos ö
=  0
cos è
0 1


 sin ö − cos ö sin è 0 1
0
0
0
0
0
0

0
1 
3D Viewing
Parallel Projections
Isometric
fx2 = xx*2 + yx*2 = cos2 ö + sin2 ö sin2 è
2
fy
fz2
*2
*2
= xy + yy
= xz*2 + yz*2
= cos è
2
= sin2 ö + cos2 ö sin2 è
3D Viewing
Parallel Projections
Isometric
f x = f y = fz = f
fx = fy ⇒ cos2 ö + sin2 ö sin2 è = cos2 è
fy = fz ⇒ sin ö + cos ö sin è = cos è
2
2
Solving equations find θ, φ and f
2
2
3D Viewing
Parallel Projections
Oblique
• Non-perpendicular projectors
to the plane of projection
• True shape and size for the
faces parallel to the projection
plane is preserved
3D Viewing
Parallel Projections
Oblique
3D Viewing
Parallel Projections
Oblique
xp = x + L cos φ
x
P(x,y,z)
z
yp = y + L sin φ
P’’(xp,yp)
α
L φ
P’(x,y)
tan α =z/L or L = z cot α
y
3D Viewing
Parallel Projections
Oblique
When α =45o => Cavalier
Lines perpendicular to the
projection plane are not
foreshortened
x
P(x,y,z)
z
P’’(xp,yp)
α
L φ
P’(x,y)
y
When cot α = ½ => Cabinet
Lines perpendicular to the
projection plane are
foreshortened by half
φ is typically 300 or 450
3D Viewing
Perspective Projections
Projectors
Center of
Projection
A
• Parallel lines converge
• Non-uniform
A’
foreshortening
B • Helps in depth
perception, important
B’
for 3D viewing
Projection Plane • Shape is not preserved
3D Viewing
Perspective Projections
3D Viewing
Perspective Projections
Matrix Form
[x
[x
y
*
y*
1
0
z 1] 
0
0

z*
0 0 0
1 0 0
 = [x y z rz + 1]
0 1 r
0 0 1
y
z
 x

1=
1
 rz + 1 rz + 1 rz + 1 
]
3D Viewing
Perspective Projections
Matrix Form
Projection on z=0 plane
1 0
0 1
T = Prz = [Pr ][Pz ] = 
0 0
0 0

 x
*
*
*
x y z 1=
 rz + 1
[
]
0 0 1 0
0 0  0 1
 
1 r  0 0
0 1 0 0
y

0 1
rz + 1

0 0
0 0

0 0
0 1
3D Viewing
Perspective Projections
Geometrically
Y
y
P*(x*,y*)
l1
y*
l2
P(x,y,z)
zc
Z
X
y*
y
zc
l2
=
,
=
l 2 l 2 − l1 zc − z l 2 − l1
y
*
⇒y =
z
1−
zc
3D Viewing
Perspective Projections
Geometrically
zc
Y
P*(x*,y*)
x*
x
l1
l2
P(x,y,z)
zc
Z
X
x*
x
x
*
=
⇒x =
z
zc zc − z
1−
zc
When r = - 1/ zc this becomes same
as obtained in matrix form
3D Viewing
Perspective Projections
Vanishing Point
Set of parallel lines not parallel to the projection plane
converge to Vanishing Point
VPz
Y
X
Z
3D Viewing
Perspective Projections
Vanishing Point
Point at infinity on +Z axis :
[0 0 1 0] (homogenous)
[x
[x
'
*
y
'
y*
z
'
z*
]
w = [0
0
= [0
0
1 = 0
0
] [
1
0
0]
0
0

r]
1
1
1
r
0
0
1
0
0
1
0
0
]
1
Recall r = -1/zc, the vanishing point is at zc
0
0

r
1 
3D Viewing
Perspective Projections
Single Point Perspective
COP on X-axis
[x
[x
y
*
y*
0 0 p
1 0 0
 = [x y z px + 1]
0 1 0
0 0 1
y
z
 x

1=
1
 px + 1 px + 1 px + 1 
1
0
z 1] 
0
0

z*
]
COP (-1/p 0 0 1) VPx (1/p 0 0 1)
3D Viewing
Perspective Projections
Single Point Perspective
COP on Y-axis
[x
[x
y
*
y*
0 0 0
1 0 q
 = [x y z qy + 1]
0 1 0
0 0 1
y
z
 x

1=
1
 qy + 1 qy + 1 qy + 1 
1
0
z 1] 
0
0

z*
]
COP (0 -1/q 0 1) VPx (0 1/q 0 1)
3D Viewing
Perspective Projections
Two Point Perspective
P
pq
=
[P p ][P q


]= 



1
0
0
0
0
0
1
0
0
0
1
0
p 
q 

0 
1 
3D Viewing
Perspective Projections
Three Point Perspective
P
pqr
=
[P p ][P q ] [P r ]


= 



1
0
0
1
0
0
0
0
0
0
1
0
p 
q 

r 
1 
3D Viewing
Perspective Projections
3D Viewing
Generation of Perspective Views
Additional transformation and then single point
perspective transformation
Simple Translation:
Translation (l,m,n),COP=zc ,Projection plane z=0
1 0
0 1
T =
0 0

l m
0 0 1
0 0 0
1 0  0

n 1  0
0 0 0  1 0
1 0 0 0 1
=
0 0 r  0 0
 
0 0 1  l m
0 
0 
0
r 

0 1 + rn 
0
0
3D Viewing
Generation of Perspective Views
Y
X
Translation along y=x line:
3D Viewing
Generation of Perspective Views
Translation in Z => Scaling
COP
Projection plane
3D Viewing
Generation of Perspective Views
Rotation
Rotation about Y-axis by φ
cosö
 0
T = [Ry ][Prz ] = 
 sinö
 0

0 − sinö 0 1
1
0
0 0

0 cosö 0 0
0
0
1 0
0 0 0
1 0 0

0 0 r
0 0 1
3D Viewing
Generation of Perspective Views
Rotation
Rotation about Y-axis by φ
cosö
 0
T = [Ry ] [Prz ] = 
 sinö
 0

0 0 − r sinö 
1 0
0 

0 0 r cosö 
0 0
1 
=> Two Point Perspective Transformation
3D Viewing
Generation of Perspective Views
Rotation
Two Rotations
a) about Y-axis by φ
b) about X-axis by θ
T = [R y ][R x ][Prz ]
cos ö
 0
=
 sin ö
 0

0
1
0
0
− sin ö
0
cos ö
0
0 1
0  0

0  0
1 0
0
cos è
− sin è
0
0
sin è
cos è
0
0 1 0
0  0 1

0  0 0
1 0 0
0
0
0
0
0
0

r
1
3D Viewing
Generation of Perspective Views
Rotation
Two Rotations
cos ö
 0
T =
 sin ö
 0

a) about Y-axis by φ
b) about X-axis by θ
sin ö sin è
cos è
0
0
− cos ö sin è
0
0
0
− r sin ö cos è 

r sin è

r cos ö cos è 

1

=> Three Point Perspective Transformation