Platform SDK: DirectX |
Full-scene antialiasing refers to blurring the edges of each polygon in the scene as it is rasterized in a single pass—no second pass is required. Note that full-scene antialiasing, when supported, only affects triangles and groups of triangles; lines cannot be antialiased by using Direct3D services.
On some hardware, full-scene antialiasing can be applied only when the application renders the polygons sorted from back to front. To find out whether this is true for the current device, retrieve the device capabilities by calling IDirect3DDevice7::GetCaps method. After the call, check the dwRasterCaps member of the associated D3DPRIMCAPS structures. If the device requires back to front rendering for antialiasing, it exposes the D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT capability flag in dwRasterCaps. If the device can perform antialiasing without regard to polygon order, it will expose the D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT flag. Of course, the absence of both flags indicates that the device cannot perform full-scene antialiasing at all.
After finding out whether or not you need to sort the polygons, set the D3DRENDERSTATE_ANTIALIAS render state to D3DANTIALIAS_SORTDEPENDENT or D3DANTIALIAS_SORTINDEPENDENT and draw the scene.
When you no longer need full-scene antialiasing, disable it by setting D3DRENDERSTATE_ANTIALIAS to D3DANTIALIAS_NONE.
On some hardware, full-scene antialiasing can be applied only when the application renders the polygons sorted from back to front. To find out whether this is true for the current device, retrieve the device capabilities by calling Direct3DDevice7.GetCaps method. After the call, check the lRasterCaps member of the associated D3DPRIMCAPS types. If the device requires back to front rendering for antialiasing, it exposes the D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT capability flag in lRasterCaps. If the device can perform antialiasing without regard to polygon order, it will expose the D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT flag. Of course, the absence of both flags indicates that the device cannot perform full-scene antialiasing at all.
After finding out whether or not you need to sort the polygons, set the D3DRENDERSTATE_ANTIALIAS render state to D3DANTIALIAS_SORTDEPENDENT or D3DANTIALIAS_SORTINDEPENDENT and draw the scene.
When you no longer need full-scene antialiasing, disable it by setting D3DRENDERSTATE_ANTIALIAS to D3DANTIALIAS_NONE.