Edge Antialiasing

You can apply edge antialiasing to edges in a scene in your application. In edge antialiasing, you specify the edges in your scene that you want the system to antialias, and the system redraws those edges, averaging the values of neighboring pixels. Although this is not the best way to perform antialiasing, it can be very efficient; hardware that supports this kind of operation is becoming more common.

After drawing your scene, use the D3DPRASTERCAPS_ANTIALIASEDGES flag in the D3DPRIMCAPS structure to find out whether the current hardware supports edge antialiasing. If it does, set the D3DRENDERSTATE_EDGEANTIALIAS flag to TRUE. Now you can redraw the edges in the scene, using IDirect3DDevice2::DrawPrimitive and either the D3DPT_LINESTRIP or D3DPT_LINELIST primitive type.

Redrawing every edge in your scene will work without introducing major artifacts, but it can be computationally expensive. The most important edges to redraw are those between areas of very different color (for example, silhouette edges) or boundaries between very different materials.

When you have finished antialiasing, set D3DRENDERSTATE_EDGEANTIALIAS to FALSE.