Geometrical data is passed to the graphics hardware in the context of a threedimensional
space. One of the jobs performed by the graphics hardware is to transform this data into geometry that can be drawn into a two-dimensional viewport. There are several different coordinate systems associated with the rendering pipeline—their relationships are shown in Figure 1.3. The vertices of a model are typically stored in object space, a coordinate system that is local to the particular model and used only by that model. The position and orientation of each model are often stored in world space, a global coordinate system that ties all of the object spaces together. Before an object can be rendered, its vertices
must be transformed into camera space (also called eye space), the space in which the x and y axes are aligned to the display and the z axis is parallel to the viewing direction. (See Section 5.3.) It is possible to transform vertices from object
space directly into camera space by concatenating the matrices representing the transformations from object space to world space and from world space to camera space. The product of these transformations is called the model-view transformation.
Once a model’s vertices have been transformed into camera space, they undergo a projection transformation that has the effect of applying perspective so that geometry becomes smaller as the distance from the camera increases. (Projections are discussed in Section 5.5.) The projection is performed in fourdimensional homogeneous coordinates, described in Section 4.4, and the space in which the vertices exist after projection is called homogeneous clip space. Homogeneous clip space is so named because it is in this space that graphics primitives are clipped to the boundaries of the visible region of the scene, ensuring that no attempt is made to render any part of a primitive that falls outside the viewport.
In homogeneous clip space, vertices have normalized device coordinates.The term normalized pertains to the fact that the x, y, and z coordinates of each vertex fall in the range [1,1], but reflect the final positions in which they will appear in the viewport. The vertices must undergo one more transformation,called the viewport transformation, that maps the normalized coordinates to the actual range of pixel coordinates covered by the viewport. The z coordinate is usually mapped to the floating-point range [0,1], but this is subsequently scaled to the integer range corresponding to the number of bits per pixel utilized by the
depth buffer. After the viewport transformation, vertex positions are said to lie in window space.
After multiplying the vertex position by the projection matrix the coordinates are said to be in Clip Space and after performing the perspective divide the coordinates are in NDC Space (Normalized Device Coordinates).
The path that we have taken in this series of tutorials should now become clear. Without doing any projection we can simply output vertices from the VS whose XYZ components (of the position vector) are within the range of [-1,+1]. This will make sure they end up somewhere in the screen. By making sure that W is always 1 we basically prevent perspective divide from having any effect. After that the coordinates are transformed to screen space and we are done. When using the projection matrix the perspective divide step becomes an integral part of the 3D to 2D projection.
Anyway, clipping. The short version is this: Your vertex shader returns vertex positions on homogeneous clip space. Clip space is chosen to make the equations that describe the view frustum as simple as possible; in the case of D3D, they are ,
,
, and
; note that all the last equation really does is exclude the homogeneous point (0,0,0,0), which is something of a degenerate case.
引用资料:
1.http://ogldev.atspace.co.uk/www/tutorial12/tutorial12.html
2.https://fgiesen.wordpress.com/2011/07/05/a-trip-through-the-graphics-pipeline-2011-part-5/
3.Mathematics for 3D Game Programming and Computer