CS475m - Computer Graphicsparagc/teaching/2016/... · CS475m - Computer Graphics Lecture 6 :...
Transcript of CS475m - Computer Graphicsparagc/teaching/2016/... · CS475m - Computer Graphics Lecture 6 :...
CS475m - Computer Graphics
Lecture 6 : Viewing
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
Image Planeor Projection Plane
Object
Projectors
Centre of Projection
CS475m: Lecture 6 Parag Chaudhuri
Parallel Projection
Image Planeor Projection Plane
Object
ProjectorsCentre of Projection?
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionOrthographic Projection
Top View
Side View
Front View
● Multiviews (x=0, y=0 or z=0 or principal planes).
● True size or shape for lines.
● For projection on the z=0 plane we get the projection matrix as
P z=0=[1 0 0 00 1 0 00 0 0 00 0 0 1
]
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● Transform and then project using an orthographic projection such that at multiple adjacent faces are visible – better representation of a 3D object using 1 view. Face parallel to projection plane shows true shape and size.
● If be the matrix formed by stacking up the unit vectors along the three axes, and be the axonometric projection, then
T.U=T . [1 0 00 1 00 0 11 1 1
]=[x x ' x y ' x z 'y x ' y y ' y z '0 0 01 1 1
]T
U
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● If be the matrix formed by stacking up the unit vectors along the three axes, and be the axonometric projection, then
T.U=T . [1 0 00 1 00 0 11 1 1
]=[x x ' x y ' x z 'y x ' y y ' y z '0 0 01 1 1
]T
U
● The foreshortening ratios for each projected principal axes are then given by:
f x= x x '2y x '2 f y= x y ' 2
yy ' 2 f z= x z ' 2yz ' 2
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● If be the matrix formed by stacking up the unit vectors along the three axes, and be the axonometric projection, then
T.U=T . [1 0 00 1 00 0 11 1 1
]=[x x ' x y ' x z 'y x ' y y ' y z '0 0 01 1 1
]T
U
● The foreshortening ratios for each projected principal axes are then given by:
f x= x x '2y x '2 f y= x y ' 2
yy ' 2 f z= x z ' 2yz ' 2
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● Depending on the kind of foreshortening they cause we can have three types of axonometric projections
— Trimetric (all foreshortenings are different)
f x≠ f y≠ f z
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● Depending on the kind of foreshortening they cause we can have three types of axonometric projections
— Trimetric (all foreshortenings are different)
— Dimetric (two foreshortenings are the same)
f x≠ f y≠ f z f x= f z
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● Depending on the kind of foreshortening they cause we can have three types of axonometric projections
— Trimetric (all foreshortenings are different)
— Dimetric (two foreshortenings are the same)
— Isometric (all foreshortenings are the same)
f x≠ f y≠ f z f x= f z f x= f y= f z
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● Assuming we rotate by and before we do the projection on the z=0 plane.
T =P z=0 . Rx . Ry
=[1 0 0 00 1 0 00 0 0 00 0 0 1
] . [1 0 0 00 cos −sin 00 sin cos 00 0 0 1
] . [cos 0 sin 00 1 0 0−sin 0 cos 00 0 0 1
]=[
cos 0 sin 0sin sin cos −sincos 00 0 0 00 0 0 1
]
Ry Rx
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● Now we apply this axonometric projection to
T.U=[cos 0 sin 0sin sin cos −sin cos 00 0 0 00 0 0 1
] .[1 0 00 1 00 0 11 1 1
]=[
cos 0 sin
sin sin cos −sin cos0 0 01 1 1
]
UT
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionAxonometric Projection
● So the foreshortening ratios become
f x2=cos2
sin2sin2
f y2=cos2
f z2=sin2
sin2 cos2
● For Isometric projections, if we solve for then we get and
f x= f y= f z
=35.26 =±45
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionOblique Projection
● The projectors are parallel to each other but they are not perpendicular to the plane of projection.
● Only planes parallel to plane of projection show true shape and size.
CS475m: Lecture 6 Parag Chaudhuri
Parallel ProjectionOblique Projection
P x , y , z
P ' x , y
P ' ' x p , y p
l
x p=xl cos
y p=yl sin
tan =zl
or l=z cot
CS475m: Lecture 6 Parag Chaudhuri
● When we get a Cavalier projection. Lines perpendicular to the projection plane are not foreshortened.
● When we get Cabinet projections. Lines perpendicular to the projection plane are foreshortened by half.
● is typically 30° or 45°.
Parallel ProjectionOblique Projection
P x , y , z
P ' x , y
P ' ' x p , y p
l
cot=1/2
=45
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
Image Planeor Projection Plane
Object
Projectors
Centre of Projection
● Projectors converge at a finite centre of projection.
● Parallel lines converge.
● We get nonuniform foreshortening.
● Shape is not preserved.
● We see in perspective – so perspective viewing seems natural and helps in depth perception.
CS475m: Lecture 6 Parag Chaudhuri
A digression into art
13th century , Arezzo by Giotto
CS475m: Lecture 6 Parag Chaudhuri
A digression into art
Early 15th century , The Little Garden of Paradise
CS475m: Lecture 6 Parag Chaudhuri
A digression into art
15th century , The Baptistry in Florence, Filippo Brunelleschi
CS475m: Lecture 6 Parag Chaudhuri
A digression into art
15th century , Fresco of Holy Trinity, Masaccio
CS475m: Lecture 6 Parag Chaudhuri
A digression into art
15th century , School of Athens, Raphael
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
P x , y , z
P ' x ' , y '
zc
y y 'l1
l2
y 'l2
=y
l 2−l1
zc
l2
=zc−z
l2−l1
⇒ y '=y
1−zzc
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
P x , y , z
P ' x ' , y '
zc
x x '
l1l2
x 'l 2
=x
l2−l1
zc
l2
=zc−z
l2−l1
⇒ x '=x
1−zzc
zc
z
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
● First we apply a perspective transform to a point that takes it to
[x 'y 'z 'w ' ]=[
1 0 0 00 1 0 00 0 1 00 0 r 1
] . [xyz1 ]=[
xyz
rz1]x '=
xrz1
, y '=y
rz1, z '=
zrz1
X '=Pr . X
X X '
CS475m: Lecture 6 Parag Chaudhuri
● If then we get
Perspective Projection
● First we apply a perspective transform to a point that takes it to
● Now we add projection on the plane.
[x 'y 'z 'w ' ]=[
1 0 0 00 1 0 00 0 0 00 0 0 1
] . [1 0 0 00 1 0 00 0 1 00 0 r 1
] . [xyz1 ]=[
xy0
rz1]x '=
xrz1
, y '=y
rz1, z '=0
X '=P z=0 . Pr . X
X X '
z=0
r=−1zc
x '=x
1−zzc
, y '=y
1−zzc
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection● Vanishing point in the z
direction.
● Set of lines not parallel to the projection plane converge at a vanishing point.
VP z
CS475m: Lecture 6 Parag Chaudhuri
● If then we get , i.e., the vanishing point lies an equal distance on the opposite side of the projection plane as the center of projection.
Perspective Projection
● To find the vanishing point along the z direction we apply the perspective transformation to the point at infinity along the z direction.
[x 'y 'z 'w ' ]=[
1 0 0 00 1 0 00 0 1 00 0 r 1
] . [0010]=[
001r] x '=0, y '=0, z '=
1r
X '=Pr . X
r=−1/ zc z '=−zc
CS475m: Lecture 6 Parag Chaudhuri
● CoP is at , VP is at
Perspective Projection
● Centre of projection (CoP) on x axis
[x 'y 'z 'w ' ]=[
1 0 0 00 1 0 00 0 1 0p 0 0 1
] .[xyz1 ]=[
xyz
px1]x '=
xpx1
, y '=y
px1, z '=
zpx1
X '=P p . X
−1/ p ,0,0,1 1/ p ,0, 0,1
Single point perspective
CS475m: Lecture 6 Parag Chaudhuri
● CoP is at , VP is at
Perspective Projection
● Centre of projection (CoP) on y axis
[x 'y 'z 'w ' ]=[
1 0 0 00 1 0 00 0 1 00 q 0 1
] . [xyz1 ]=[
xyz
qy1]x '=
xqy1
, y '=y
qy1, z '=
zqy1
X '=Pq . X
0,−1/q , 0,1 0,1/q ,0,1
Single point perspective
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
P pq=P p .Pq=[1 0 0 00 1 0 00 0 1 0p 0 0 1
] .[1 0 0 00 1 0 00 0 1 00 q 0 1
]=[1 0 0 00 1 0 00 0 1 0p q 0 1
]Two point perspective
x '=x
pxqy1, y '=
ypxqy1
, z '=z
pxqy1
● Two vanishing points
● Two CoPs?
From http://gatewayhsart.wordpress.com
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
P pqr=P p . Pq . Pr=[1 0 0 00 1 0 00 0 1 0p q r 1
]Three point perspective
x '=x
pxqyrz1, y '=
ypxqyrz1
● Three vanishing points
● Three CoPs?
z '=z
pxqyrz1
M. C. Esher, Ascending and Descending
CS475m: Lecture 6 Parag Chaudhuri
Perspective Projection
T =Pr z=0 . T l , m , n=[1 0 0 00 1 0 00 0 0 00 0 r 1
] . [1 0 0 l0 1 0 m0 0 1 n0 0 0 1
]=[1 0 0 l0 1 0 m0 0 0 00 0 r rn1
]
Generation of perspective views
● Transform and then apply single point persepective.
● Let us try to translate, apply a perspective and project to z=0
CS475m: Lecture 6 Parag Chaudhuri
Perspective ProjectionGeneration of perspective views
● Translation along x=y line.
CS475m: Lecture 6 Parag Chaudhuri
Perspective ProjectionGeneration of perspective views
● Translation along the z axis causes change in scaling.
z −z
y
−y
CS475m: Lecture 6 Parag Chaudhuri
Perspective ProjectionGeneration of perspective views
● Rotate about y axis and then apply single point persepective projection.
T =Pr z=0 . Ry =[1 0 0 00 1 0 00 0 0 00 0 r 1
] .[cos 0 sin 0
0 1 0 0−sin 0 cos 0
0 0 0 1]
CS475m: Lecture 6 Parag Chaudhuri
Perspective ProjectionGeneration of perspective views
● Rotate about y axis and then apply single point persepective projection.
T =Pr z=0 . Ry =[1 0 0 00 1 0 00 0 0 00 0 r 1
] .[cos 0 sin 0
0 1 0 0−sin 0 cos 0
0 0 0 1]
=[cos 0 sin 0
0 1 0 00 0 0 0
−r sin 0 r cos 1]
● We get a two point perspective.
CS475m: Lecture 6 Parag Chaudhuri
Perspective ProjectionGeneration of perspective views
● Rotate about y axis, x axis and then apply single point persepective projection.
T =Pr z=0 . Rx . R y
=[1 0 0 00 1 0 00 0 0 00 0 r 1
] . [1 0 0 00 cos −sin 00 sin cos 00 0 0 1
] . [cos 0 sin 0
0 1 0 0−sin 0 cos 0
0 0 0 1]
CS475m: Lecture 6 Parag Chaudhuri
Perspective ProjectionGeneration of perspective views
● Rotate about x axis, y axis and then apply single point persepective projection.
T =Pr z=0 . Ry , Rx
=[cos 0 sin 0
sin sin cos −sin cos 00 0 0 0
−r cos sin r sin r coscos 1]
● We get a three point perspective.
CS475m: Lecture 6 Parag Chaudhuri
Taxonomy
Parallel Perspective
Orthographic ObliqueAxonometric
Trimetric
Dimetric
Isometric
Cavalier
Cabinet
Front
Top
Side
Planar Projections
One Point
Two Point
Three Point