Version: 6000.3
语言: 中文
在着色器中设置深度剪辑模式
禁用写入着色器中的深度缓冲区

在着色器中设置深度测试模式

深度测试允许具有“Early-Z”功能的 GPU 在管道的早期拒绝几何体,并确保几何体的正确排序。您可以更改深度测试的条件以实现对象遮挡等视觉效果。

例子

此示例代码演示了在 Pass 块中使用此命令的语法。

Shader "Examples/CommandExample"
{
    SubShader
    {
         // The rest of the code that defines the SubShader goes here.

        Pass
        {    
              // Sets the depth test operation to Equal for all pixels in this Pass
              // You would typically do this if you want to render the geometry exactly where already rendered geometry is
              ZTest Equal
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

此示例代码演示了在 SubShader 块中使用此命令的语法。

Shader "Examples/CommandExample"
{
    SubShader
    {
        // Sets the depth test operation to Equal for all pixels in this Pass
        // You would typically do this if you want to render the geometry exactly where already rendered geometry is
        ZTest Equal

         // The rest of the code that defines the SubShader goes here.        

        Pass
        {    
              // The rest of the code that defines the Pass goes here.
        }
    }
}

其他资源

在着色器中设置深度剪辑模式
禁用写入着色器中的深度缓冲区