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:

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:

Figure 5 shows how varies as a monotonically increasing, but non-linear function of*z*.

**Figure:**The graphs below show how the normalized device*z*-coordinate (vertical axis) varies as a non-linear, monotonically increasing function of -*z*, the distance from a point to the eye XY-plane (horizontal axis) when using the matrix**Q**. In the three cases shown, . The value of is -10, -1 and -0.1 in the left, middle and right graph respectively. Notice that the closer comes to the eyepoint*z*=0, the less uniformly the Z-buffer is filled: a larger range of eye*z*-values will be mapped onto a smaller range of Z-buffer values (values close to ). When the Z-buffer has only a limited resolution (e.g. 16 bits), hidden face elimination with the Z-buffer algorithm will not work well for points in the far distance: points with large depth differences could then be represented by the same discrete Z-buffer value. This is why in practice, one should take care to position the front clipping plane as far as possible from the eye point.

- 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*y*by (2). The scaling factors are with*W*and*H*given in (11) (check this yourself!). The complete projection matrix for symmetrical perspective is then:

- 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:

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.

- A

출처 : http://www.cs.kuleuven.ac.be/cwis/research/graphics/INFOTEC/viewing-in-3d/node8.html

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

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

역행렬 구하기 (0) | 2008.03.05 |
---|---|

이중선형 필터링 (0) | 2008.03.05 |

Perspective projection matrix (0) | 2008.03.05 |

다각형을 가져오기 위한 노력... (0) | 2008.03.04 |

ImageWarping Processing (0) | 2008.02.26 |

PNG 분석자료들 (0) | 2008.02.24 |