What is the stencil buffer typically used for?
- Storing per-pixel surface normals
- Holding depth for shadow maps
- Masking which pixels may be drawn
- Caching the previous frame image
Draws can write reference values to the stencil and later draws test against them, enabling portals, outlines, mirrors and masked UI.
Play Game Dev ▸