包含此页的版本:
不含此页的版本:
这Blend命令确定 GPU 如何组合片段的输出着色器在 GPU 上运行的程序。更多信息
请参阅术语表替换为渲染目标。
此命令的功能取决于混合作,您可以使用 BlendOp 命令进行设置。请注意,虽然所有图形 API 和硬件都支持混合本身,但某些混合作的支持更为有限。
启用混合会禁用GPU上的某些优化(主要是隐藏表面移除/Early-Z),这可能导致GPU帧时间增加。
以下是最常见的混合类型的语法:
Blend SrcAlpha OneMinusSrcAlpha // Traditional transparency
Blend One OneMinusSrcAlpha // Premultiplied transparency
Blend One One // Additive
Blend OneMinusDstColor One // Soft additive
Blend DstColor Zero // Multiplicative
Blend DstColor SrcColor // 2x multiplicative
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Enable regular alpha blending for this Pass
Blend SrcAlpha OneMinusSrcAlpha
// The rest of the code that defines the Pass goes here.
}
}
}
此示例代码演示了在 SubShader 块中使用此命令的语法。
Shader "Examples/CommandExample"
{
SubShader
{
// Enable regular alpha blending for this SubShader
Blend SrcAlpha OneMinusSrcAlpha
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}