Perspective Projection

advertisement
Projection
1
Pipeline Review
Modelview
Matrix
Model
Transform
Viewing
Transform
world
coordinates
Focus of this lecture
2
Review (Lines in
2
R)
x  wu , y  wv
ax  by  c  0  
 au  bv  cw  0
l  (a, b, c), p  (u, v, w)
Homogeneous line equation
p l  0
T wo pointsdeterminea line :
p1  l  0 and p2  l  0  l  p1  p2
P ointas intersection of two lines :
p  l1  0 and p  l2  0  p  l1  l2
3
a  b c  c  ba  c  a b
c  a  b   c  b a  c  a b
Projection
2
(R )
viewline
viewpoint
Parallel Projection
4
Perspective Projection
~
~
5
Parallel Projection
~
~
6
Projection
3
(R )
See handout for proof!
7
Example
Vertices (0,0,0), (2,0,0), (2,3,0), (0,3,0)
(1,1,1), (1,2,1)
Parallel projection: onto z = 0 plane
v = (0,0,1,0)T, n = (0,0,1,0)T
8
Vertices (0,0,0), (2,0,0), (2,3,0), (0,3,0)
(1,1,1), (1,2,1)
Perspective projection: onto z = 0 plane from viewpoint (1,5,3)
v = (1,5,3,1)T, n = (0,0,1,0)T
9
Viewplane Coordinate Mapping
O  q1 , q2 , q3 
rˆ  r1 , r2 , r3 
sˆ  s1 , s2 , s3 
p”
p’
O
10
Determine Viewplane Transform
by Homogeneous Transformation
p31  V34 p41
 q1

 q2
q
 3
1

r1
r2
r3
0
p41  K43 p31
s1  
 
s2  
  K4×3

s3
 
0  

 0 1 0 


 0 0 1 
 1 0 0 


11
p31  V34 p41
p41  K43 p31
L Kp  Ip
L: left inverse of K
L
p 
12
Viewplane
origin (1,2,0)
u-axis (3,4,0)
v-axis (-4,3,0)
Example
13
Orthographic Projection
• Def: direction of projection  viewplane
viewplanevector: n  n1 , n2 , n3 , n4 
viewpoint: v  n1 , n2 , n3 ,0
n
v
… is a parallel
projection
  (n22  n32 )

n1n2
n1n3
n1n4


 (n12  n32 )
n2 n3
n2 n4
 n1n2



2
2
n2 n3
 (n1  n2 )
n3 n4
 n1n3

2
2
2 

0
0
0
 (n1  n2  n3 ) 

14
Definitions
• Direction cosine (ref)
Ay
Ax
A
l  cos 
, m  cos  
, n  cos  z
A
A
A
l 2  m2  n2  1
• Foreshortening ratio
= (length of projected segment)/(length of original segment)
15
Theorem
• If the direction cosines of the plane normal (in
world coordinate system) are n1, n2, and n3, the
foreshortening ratios in the x-, y-, and z- directions
are (n22 + n32)1/2, (n12 + n32)1/2, and (n12 + n22)1/2,
respectively.
• Front, side, top views: n =
(1,0,0,0), (0,1,0,0), or (0,0,1,0)
as in engineering drawings
16
Types of Orthographic
Projections
• Axonometric projections: attempts to
portray general 3D shape
– Isometric projection: all foreshortening ratio are
the same
– Dimetric projection: exactly two are the same
– Trimetric projection: all foreshortening ratio are
different
17
Axonometric Projections
Isometric

f 
n
1
3
6
3
,
,
1
3
,
6
3
,
Dimetric
1
3
,0
6
3


,
f 
n
1
3
7
3
2 2
3
,
f: foreshortening ratios
, 13 ,0
2
3

, 2 32
Trimetric

n
f 


3
3
, 7153 , 153 ,0
2
3
,
26
75
,

74
75
18

n

1
3
7
3
 89
 7
M  9
 1
 9
 0
1
3
Example (Dimetric)
0
7
9
2
9
7
9
1
9
7
9
8
9


0
0
o  0 0 0 1
T
x  1 0 0 1
T
y  0 1 0 1
T
z  0 0 1 1
T
0

0
0

 1
o'  0 0 0  1
T

y'  
z'  
x' 
8
9
1
9
7
9
7
9
2
9
7
9
7
9
8
9

1
1
9
T

1

1
T
T
ox 
2 2
3
oy  
2
3
oz  
2 2
3
19
20
Oblique Projection
• A particular parallel projection where
direction of projection is not perpendicular
to viewplane
n
v
Oblique projection
not available in
OpenGL
21
Cavalier Projection
n
p/4
v
viewplane
Properties:
Lines  viewplane have f = 1
Planar faces  viewplane appear thicker
22
Cabinet Projection
n
f = arccot(2)
v
Properties:
To overcome ‘thickness’ problem, choose
f  viewplane to be 1/2
23
Perspective Projection
• A perspective
projection maps
parallel lines in the
space to parallel lines
in the viewplane IFF
the lines are parallel to
the viewplane.
24
Otherwise, they meet
25
Vanishing Point
• Suppose (xi, yi, zi) i =1,2,3 are a set of
mutually perpendicular vectors. The
viewplane normal (n1, n2, n3) of a
perspective projection can be perpendicular
to (a) none (b) one (c) two of the vectors.
n
n
(a)
(b)
n
(c)
26
Vanishing Point
• If a perspective projection maps a point-atinfinity (x,y,z,0) to a finite point (x’,y’,z’,1)
on the viewplane, the lines in the direction
(x,y,z) appear as lines converging to point
on the (Cartesian) viewplane. The point
(x’,y’,z’) is called the vanishing point in the
direction (x,y,z).
27
Three-point perspective
Vanishing point
Two-point perspective
One-point perspective
28
IMAGE FORMATION – Perspective Imaging
“The Scholar of Athens,” Raphael, 1518
Image courtesy of C. Taylor
29
Example
• Determine (and verify it is indeed so) the
vanishing point of an OpenGL setting.
Eye = [15,0,0]
Eye = [15,0,15]
30
Numeric Example
v  15 0 15 1
T
n  1 0 1 1
Viewpoint (15,0,15,1)
Viewplane: x + z + 1 = 0
T
15
15 
 16 0
 0  31 0

0

M  vnT  n  v I 4  
 15
0  16 15 


0
1
 30
 1
Verify :
M 1 0 0 0   16 0 15 1
T
T
M 0 0 1 0  15 0  16 1
T
T
How about
(1,0,1,0)?
M 0 1 0 0  0  31 0 0
T
T
31
Summary
• Projection
Understand how
they are
differentiated
– Parallel projection
– Perspective projection
• Parallel projection
– Orthographic
• Isometric
• Dimetric
• Trimetric
– Oblique
• Perspective projection
– Three-point
perspective
– Two-point perspective
– One-point perspective
• Cavalier
• Cabinet
32
Fig. 8. Constructing a perspective image of a house. (a) Drawing the floor plan and defining the viewing conditions (observer
position and image plane). (b) Constructing a perspective view of the floor. (c) A reference height (in this case the height of
an external wall) is drawn from the ground line and the first wall is constructed in perspective by joining the reference end
points to the horizontal vanishing point v2. (d) All four external walls are constructed. (e) The elevations of all other objects
33
(the door, windows and roofs) are first defined on the reference segment and then constructed in the rendered perspective
view.
Exercise
• Hand sketch a perspective drawing of a
house
• Use Maxima to compute 2-point perspective
projection, setting viewplane coordinate
system
34
Cross Ratio
Cross ratio is preserved in
projective geometry
(ratio is NOT preserved)
The cross-ratio of every set of four collinear points shown
in this figure has the same value
z1
z2
z3 z4
35
Download