深度测试可使具有“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.
}
}
}