Engineering drawings of complex objects (such as automobiles) may show a cutaway view, removing some layers of the object (such as the outer shell) in order to reveal the object's inner components and their respective positions. When the purpose of the drawing is more sales-oriented, the cutaway view may be done in a more artistic style, with the cut edge of object's outer shell faded gradually and the parts of the edge closer to the viewer becoming more and more transparent. Additional stylistic touches can be added by showing the seams of the object shell, and have them also fade to transparency at a slightly different rate than the shell surface itself.
This effect can be done in a straightforward way using OpenGL. This technique uses texture mapping and texture coordinate generation to modulate the alpha component of an object's shell. The object must be divided into two parts that can be rendered separately; the object's shell and the object's interior. The interior is rendered first in a standard fashion, using depth buffering. The object shell is rendered, but a one-dimensional texture map containing an alpha component ramp is used to modulate the object color.
If alpha blending is enabled, using glBlendModeGL_ SRC_ALPHA, GL_ ONE_MINUS_SRC_ALPHA(GL_ SRC_ALPHA, GL_ ONE_MINUS_SRC_ALPHA), the texture map will scale down the alpha component of the shell as it gets closer to the viewer, rendering it more transparent. The edges of the shell can be rendered as a separate pass, using a slightly different 1D texture map or different texgen plane equation to produce a different rate of transparency change from that of the shell surface.
Since the shell itself is blended, it must be handled as a transparent object to avoid render order artifacts. Both depth buffering and alpha blending using GL_ SRC_ALPHA for the source and GL_ ONE_MINUS_SRC_ALPHA for the destination require depth sorted primitives in order to work reliably. The shell should be sorted so the surfaces more distant from the viewer are rendered first. If the shell is convex, and the surface primitives are oriented consistently, an easy way to do this is with face culling. If the shell primitives are oriented to be outward facing, rendering the shell twice, first with front face, then back face culling will draw the surfaces in the proper depth order. For more information, see Section 12 in these course notes.