将 GPU 的深度剪辑模式设置为钳位模式对于模板阴影渲染很有用;这意味着当几何体超出远平面时,不需要特殊情况处理,从而减少了渲染操作。但是,它可能会导致 Z 顺序不正确。
此示例代码演示了在 Pass 块中使用此命令的语法。
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Sets the GPU's depth clip mode to clamp for this Pass
// You would typically do this if you are rendering stencil shadows
ZClip False
// The rest of the code that defines the Pass goes here.
}
}
}