Platform SDK: DirectX |
In edge antialiasing, you render a scene, then re-render the convex silhouettes of the objects to be antialiased with lines. The system redraws those edges, blurring them to reduce artifacts.
If a device supports edge antialiasing, it exposes the D3DPRASTERCAPS_ANTIALIASEDGES capability flag in the D3DPRIMCAPS structure (filled by calling the IDirect3DDevice7::GetCaps method). If it does, set the D3DRENDERSTATE_EDGEANTIALIAS render state to TRUE, then redraw only the edges in the scene, using IDirect3DDevice7::DrawPrimitive and either the D3DPT_LINESTRIP or D3DPT_LINELIST primitive type. The behavior of edge antialiasing is undefined for primitives other than lines, so make sure to disable the feature by setting D3DRENDERSTATE_EDGEANTIALIAS to FALSE when antialiasing is complete.
If a device supports edge antialiasing, it exposes the D3DPRASTERCAPS_ANTIALIASEDGES capability flag in the D3DPRIMCAPS type (filled by calling the Direct3DDevice7.GetCaps method). If it does, set the D3DRENDERSTATE_EDGEANTIALIAS render state to True, then redraw only the edges in the scene, using Direct3DDevice7.DrawPrimitive and either the D3DPT_LINESTRIP or D3DPT_LINELIST primitive type. The behavior of edge antialiasing is undefined for primitives other than lines, so make sure to disable the feature by setting D3DRENDERSTATE_EDGEANTIALIAS to False when antialiasing is complete.
Redrawing every edge in your scene can work without introducing major artifacts, but it can be computationally expensive. In addition, it can be difficult to determine which edges should be antialiased. The most important edges to redraw are those between areas of very different color (for example, silhouette edges) or boundaries between very different materials. Antialiasing the edge between two polygons of roughly the same color will have no effect, yet is still computationally expensive. For these reasons, full-scene antialiasing is often preferred, given that the current hardware supports it. For more information, see Full-scene Antialiasing.