Graphics Programs Reference
In-Depth Information
As a simple application of these results, let's select h = v =45 , which implies
m = n = 1. Let's also assume screen dimensions of 100
100 pixels, a local origin at
the center of the screen, and k =1. Forpoint P =(1 , 2 , 1), we get the scale factors
×
m ( z + k ) =
x
1
1+1 =
y
n ( z + k ) =
2
1+1 =1 .
c x =
0 . 5 ,
y =
Thus, the screen coordinates are s x =50
50 = 50 (the
top of the screen). However, any point with coordinates (1 ,y, 1) where y> 2would
produce a scale factor c y > 1, implying that its projection is outside the screen.
×
(
0 . 5) =
25 and s y =1
×
Exercise 3.27: Why is Equation (3.18) asymmetric with respect to x and y (i.e., why
x and not
y )?
3.9.1 Perspective Depth
The perspective projection converts a three-dimensional point to a two-dimensional
point. It completely erases any information about the depth (the z coordinate) of the
original point. However, certain algorithms for hidden surface removal need precisely
such information. We therefore need to generalize our perspective projection to create
a third coordinate z with information about the original z coordinate of the projected
point.
The obvious choice is z
= z , but this has a serious downside: It does not
preserve straight lines.
Imagine two three-dimensional points, P 1 =( x 1 ,y 1 ,z 1 )and P 2 =( x 2 ,y 2 ,z 2 ),
projected to the points
P 1 = x 1 k
k + z 1 ,z 1
P 2 = x 2 k
k + z 2 ,z 2 .
y 1 k
y 2 k
k + z 1 ,
and
k + z 2 ,
Note that the two projected points are not necessarily on the projection plane. We say
that they are located in the image space .
The straight segment P ( t )= P 1 +( P 2
P 1 ) t (Equation (Ans.7)) connects the two
original points, while the segment P ( u )= P 1 +( P 2
P 1 ) u connects the two projected
ones. It can be shown that an arbitrary point P ( t 0 )on P ( t ) is projected to a point
that's not on P ( u ).
This is why the perspective depth projection is not chosen simply as z = z but as
z = z/ ( k + z ). This definition preserves depth information, because it has the property
z 1 >z 2
z 1 >z 2 . It also preserves straight lines.
Exercise 3.28: Prove the claim above.
Search WWH ::




Custom Search