In a polyhedral model, a silhouette is an edge that is connected to both a front facing and a back facing polygon. The following is pseudo code for the basic algorithm:
draw shaded front faces draw front faces in line mode: setting only stencil draw back faces in line mode: setting color if stencil was set decrementing stencil if drawn
To draw lines over polygons, the PolygonOffset extension (or PolygonOffset function in GL 1.1) [18] is needed. This function effectively modifies the depth values of the first pass based on the slope of the triangles and a bias factor. This technique can create something similar to a silhouette, effectively a halo. The depth values are pushed forward instead of back to allow lines to be rasterized over faces. Then wide lines are drawn. Where there are large discontinuities in depth (silhouettes and boundaries), only part of the line is drawn. This method requires only two passes instead of the three listed above, but can be fairly sensitive to the parameters of the polygon offset function. Using OpenGL hardware makes the implementation simple, however, it limits the thickness of the edge lines.
Another hardware technique is to add the edge lines to a shading environment map as a preprocess. However, as shown in Figure 7(a), the lines lack crispness, and if the model varies greatly in curvature, there may be large black regions. In order to include silhouettes on the feet of the cow in Figure 7(b), we have to set the threshold low enough to draw lines in these high curvature regions. This causes regions which have relatively low curvature to be filled in with black. Although this effect produces some interesting, artistic results, it may be inappropriate for technical illustration.