首页 > 代码库 > Stencil
Stencil
【Stencil】
The stencil buffer can be used as a general purpose per pixel mask for saving or discarding pixels.
The stencil buffer is usually an 8 bit integer per pixel. The value can be written to, increment or decremented. Subsequent draw calls can test against the value, to decide if a pixel should be discarded before running the pixel shader.
Stencil测试在Fragment Shader之前进行。也即光栅化后进行的第一个Test,Stencil-Test过后是ZTest。
[Syntax]
Comp, Pass, Fail and ZFail will be applied to the front-facing geometry, unless Cull Front is specified, in which case it‘s back-facing geometry. You can also explicitly specify the two-sided stencil state by defining CompFront, PassFront, FailFront, ZFailFront (for front-facing geometry), and CompBack, PassBack, FailBack, ZFailBack (for back-facing geometry).
[Comparison Function]
[Stencil Operation]
[Deferred rendering path]
to be continued...
参考:file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Components/SL-Stencil.html