将 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.
}
}
}