?/TD>
Microsoft DirectX 9.0

Clipping Volumes


The results of the projection matrix determine the clipping volume in projection space. Microsoft?Direct3D?defines the clipping volume in projection space as:

Clipping volume

In the preceding formulas, X, Y, Z, and W represent the vertex coordinates after the projection transformation is applied. Any vertices that have an x-, y-, or z-component outside these ranges are clipped, if clipping is enabled (the default behavior).

With the exception of vertex buffers, applications enable or disable clipping by way of the D3DRS_CLIPPING render state. Clipping information for vertex buffers is generated during processing, for more information see Fixed Function Vertex Processing and Programmable Vertex Processing.

Direct3D does not clip transformed vertices of a primitive from a vertex buffer unless it comes from IDirect3DDevice9::ProcessVertices. If you are doing your own transforms and need Direct3D to do the clipping you should not use vertex buffers; in this case, the application traverses the data to transform it, Direct3D traverses the data a second time to clip it, and then the driver renders the data which is inefficient. So, if the application transforms the data is should also clip the data.

When the device receives pre-transformed and lit vertices (TL-vertices) that need to be clipped, in order to perform the clipping operation, the vertices are back transformed to the clipping space using the vertex's rhw and the viewport information. Clipping is then performed. Not all devices are capable of performing this back-transform in order to clip TL-vertices.

The D3DPMISCCAPS_CLIPTLVERTS device capability indicates whether the device is capable of clipping TL-vertices. If this capability is not set, then the application is responsible for clipping the TL-vertices that it intends to send down to the device to be rendered. The device is always capable of clipping TL-vertices in the software vertex processing mode (either when the device itself is created in the software vertex processing mode or switched to the software vertex processing mode when created as a mixed mode vertex processing device using the D3DRS_SOFTWAREVERTEXPROCESSING renderstate).



© 2002 Microsoft Corporation. All rights reserved.