DirectX SDK |
The stencil buffer can be used for more abstract effects, such as outlining and silhouetting.
If your program applies a stencil mask to the image of a primitive that is the same shape, but slightly smaller than the primitive, the resulting image will only contain the primitive's outline. It can then fill the stencil-masked area of the image with a solid color, giving the primitive an embossed look.
If the stencil mask is the same size and shape as the primitive you are rendering, the resulting image will contain a "hole" where the primitive should be. Your program can then fill the "hole" with black to produce a silhouette of the primitive.