We are looking for a transformation matrix for homogeneous coordinates which will map the viewing frustum, a truncated pyramid as described earlier, onto the standard cube in homogeneous coordinates :

• First, we consider the case of symmetrical perspective projection with and r=1 (square window). The central projection (with center in the origin) of the viewing frustum on the plane z=-1 is then the square [-1,+1]2.

This central projection is described by the following transformation matrix: (11)

Indeed: the resulting point has affine coordinates , which is precisely the intersection of the line from the origin to the point (x,y,z) with the z=-1 plane.

This transformation suffices when we are not interested in z'. This is the case when no visible face determination is needed.

• The projection matrix P in (15) leaves the z-coordinate unchanged. After division by w'=-z we always obtain z''=-1. Due to the perspective division it is no longer possible to determine z'' as a linear function of z, as was the case in the third step of §5.1. However, it is still possible to construct the projection matrix such that is a monotonically increasing (non-linear) function of the depth -z of the point, in the range [-1,+1]. Fortunately, this is all we need for visible surface determination.

z' is determined by the coefficients in the third row of P. We will now determine those coefficients so as to obtain the desired effect. The new matrix is designated by Q. There is no need for z' to depend on x or y. Therefore, the first two coefficients can have value 0. We will call the last two coefficients a and b. An arbitrary point (x,y,z,1), in eye coordinates, is then transformed into: (12)

We want to map onto -1 and onto +1: = -1 = +1 (13)

These two relations lead to a set of two equations with two unknowns a and b. Their solution is:
 a = b = (14)

Figure 5 shows how varies as a monotonically increasing, but non-linear function of z. • The matrix Q suffices for symmetrical perspective projection with and r=1. The general case should first be reduced to this special case. This step corresponds to the second step in §5.1

• A symmetrical perspective projection with and/or is reduced to the previous case by simply scaling x and yby (2). The scaling factors are with W and H given in (11) (check this yourself!). The complete projection matrix for symmetrical perspective is then: (15)

• For asymmetrical perspective projection the frustum is first transformed such that its axis coincides with the negative Z-axis. This requires a translation perpendicular to the Z-axis, over a distance proportional to -z (see figure 6). The top of the frustum lies in the origin and should remain there. The center of the front plane of the frustum should be mapped onto . This is called a shearing-transformation. The required transformation matrix is (check for yourself!): (16)

The projection on the z=-1 plane is now symmetrical about the Z-axis, but its dimensions are not yet correct. The shearing transformation is therefore followed by a scaling transformation (2) with (17) reduces the dimensions and of the projection in the z=-1 plane to 2 units in the x and the y direction. The complete asymmetrical perspective projection matrix is: (18)

You should verify that this transformation, followed by a division by w', yields the same x'' and y'' as in §5.1. The z'' however is different, but still adequate for hidden face elimination. 출처 : http://www.cs.kuleuven.ac.be/cwis/research/graphics/INFOTEC/viewing-in-3d/node8.html

혹시모르는 페이지 저장..

#### '알고리즘 > 이미지 처리' 카테고리의 다른 글

 역행렬 구하기  (0) 2008.03.05 2008.03.05 2008.03.05 2008.03.04 2008.02.26 2008.02.24