Graphics Reference
In-Depth Information
Figure 3.56. A depiction of the clipping process.
The implementation of this process is hardware dependent, but it will generate new
vertices at the boundary of the unit cube, to allow the new primitives to be created. An im-
portant point to consider during this process is that these generated vertices receive inter-
polated attribute values from the original vertices, which will then be used later to perform
the actual rasterization process.
Like the culling mechanism, the primitive clipping hardware can also be used by the
developer to perform customized per-fragment clipping. By using the SV_ClipDistance
system value attribute, each vertex can specify its location relative to a user-defined clip-
ping function. This can be used to implement custom clipping planes, or some other func-
tion that will provide an appropriate clipping result. These attributes are interpolated across
the primitive, and a per-fragment clipping test is performed. If the interpolated attribute
value is negative, then the fragment is discarded. Multiple clipping functions can be imple-
mented by using more than one component of a vertex attribute. For example, if a vertex at-
tribute is declared as a float4 type, then the results of the four different clipping functions
can be specified with one result in each component. This allows for a significant number of
tests to be performed simultaneously.
Homogenous Divide
Once a primitive has passed through the culling and clipping operations, the homogenous di-
vide is performed. This process simply divides the projected points by their W -components,
as we discussed earlier, producing homogenous coordinates of the form [X/W, Y/W, Z/W, 1].
This format is referred to as normalized device coordinates, since the size of each coordi-
nate has been scaled by the W -coordinate. Prior to this conversion, the coordinates are still
in clip space, which is the form produced by the projection matrix. The input clip space
points may or may not have a W -coordinate value of 1.
Search WWH ::




Custom Search