ZWrite 可设置在渲染过程中是否更新深度缓冲区内容。ZWrite 通常对不透明对象启用,对半透明对象禁用。
禁用 ZWrite 可能会导致不正确的深度排序。这时您需要在 CPU 上对几何体进行排序。
此示例代码演示在 Pass 代码块中使用此命令的语法。
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Disables writing to the depth buffer for this Pass
ZWrite Off
// The rest of the code that defines the Pass goes here.
}
}
}
此示例代码演示在 SubShader 代码块中使用此命令的语法。
Shader "Examples/CommandExample"
{
SubShader
{
// Disables writing to the depth buffer for this SubShader
ZWrite Off
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}