- Stencil buffer
A
stencil buffer is an extra buffer, in addition to the "color buffer " (pixel buffer ) and "depth buffer" (z-buffering ) found on moderncomputer graphics hardware . The buffer is per pixel, and works oninteger values, usually with a depth of onebyte per pixel. The depth buffer and stencil buffer often share the same area in the RAM of the graphics hardware.In the simplest case, the stencil buffer is used to limit the area of rendering (stenciling). More advanced usage of the stencil buffer make use of the strong connection between the depth buffer and the stencil buffer in the rendering pipeline (for example, stencil values can be automatically increased/decreased for every pixel that failed or passed the depth test).
The simple combination of depth test and stencil modifiers make a vast number of effects possible (such as
shadow s, outline drawing or highlighting of intersections between complex primitives) though they often require several rendering passes and, therefore, can put a heavy load on the graphics hardware.The most typical application is still to add shadows to 3D applications. It is also used for planar reflections.
Other rendering techniques, such as
portal rendering , use the stencil buffer in other ways; for example, it can be used to find the area of the screen obscured by a portal and re-render those pixels correctly.The stencil buffer and its modifiers can be accessed in computer graphics APIs like
OpenGL andDirect3D .ee also
*
Z-buffering (depth buffer)
*Shadow volume (a stencil buffer technique creating shadows)
Wikimedia Foundation. 2010.