Version: Unity 6.0 (6000.0)
语言 : 中文
设置 GPU 渲染到的颜色通道
使用 Category 代码块对命令进行分组

使用 AlphaToMask 模式减少锯齿

Alpha-to-coverage 模式可以减少将多样本抗锯齿 (MSAA) 与使用 Alpha 测试的着色器(如植被着色器)一起使用时出现的过度锯齿。为此,它根据片元着色器结果输出中的 Alpha 值按比例修改多样本覆盖率遮罩。

此命令旨在与 MSAA 一起使用。如果在不使用 MSAA 时启用 alpha-to-coverage 模式,结果无法预测;不同的图形 API 和 GPU 对此有不同的处理方式。

示例

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

        Pass
        {    
              // Enable alpha-to-coverage mode for this Pass
              AlphaToMask On
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

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

Shader "Examples/CommandExample"
{
    SubShader
    {
         // Enable alpha-to-coverage mode for this SubShader
         AlphaToMask On

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

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

其他资源

设置 GPU 渲染到的颜色通道
使用 Category 代码块对命令进行分组