Blend コマンドで使用されるブレンディング操作を指定します。このコマンドが効果を発揮するためには、同じ Pass ブロック (このコマンドが Pass ブロック内にある場合) または SubShader ブロック (このコマンドが SubShader ブロック内にある場合) に Blend コマンドが存在する必要があります。
すべてのデバイスですべてのブレンディング操作がサポートされているわけではなく、サポート対象かどうかは、グラフィックス API とハードウェアの 2 つによって決まります。グラフィックス API によって、サポートされていないブレンディング操作の扱いは異なります。GL はサポートされていない操作をスキップし、Vulkan と Metal は Add 操作にフォールバックします。
| 機能名 | ユニバーサルレンダーパイプライン (URP) | HD レンダーパイプライン (HDRP) | カスタム SRP | ビルトインレンダーパイプライン |
|---|---|---|---|---|
| BlendOp | はい | はい | はい | はい |
このコマンドは、レンダー状態を変更します。Pass ブロックで使用すると、そのパスのレンダー状態を設定することができます。また、SubShader ブロックで使用すると、そのサブシェーダー内のすべてのパスのレンダー状態を設定することができます。
| シグネチャ | 構文例 | 機能 |
|---|---|---|
BlendOp <operation> |
BlendOp Sub |
Blend コマンドで使用するブレンド操作を設定します。 |
| パラメーター | 値 | 機能 |
|---|---|---|
| operation | Add |
同時にソースとデスティネーションを追加します。 |
Sub |
ソースからデスティネーションを減算します | |
RevSub |
デスティネーションからソースを減算します | |
Min |
このステージの値は Source Alpha の値を乗算します。(1) | |
Max |
ソースとデスティネーションの大きい方を使用してください。(1) | |
LogicalClear |
論理演算: Clear (0) (1) |
|
LogicalSet |
論理演算: Set (1) (1) |
|
LogicalCopy |
論理演算: Copy (s) (1) |
|
LogicalCopyInverted |
論理演算: Copy inverted (!s)2 |
|
LogicalNoop |
論理演算: Noop (d) (1) |
|
LogicalInvert |
論理演算: Invert (!d) (1) |
|
LogicalAnd |
論理演算: And (s & d) (1) |
|
LogicalNand |
論理演算: Nand !(s & d) (1) |
|
LogicalOr |
論理演算: Or (s | d) (1) |
|
LogicalNor |
論理演算: Nor !(s | d) (1) |
|
LogicalXor |
論理演算: Xor (s ^ d) (1) |
|
LogicalEquiv |
論理演算: Equivalence !(s ^ d) (1) |
|
LogicalAndReverse |
論理演算: Reverse And (s & !d) (1) |
|
LogicalAndInverted |
論理演算: Inverted And (!s & d) (1) |
|
LogicalOrReverse |
論理演算: Reverse Or (s | !d) (1) |
|
LogicalOrInverted |
論理演算: Inverted Or (!s | d) (1) |
|
Multiply |
高度な OpenGL ブレンディング操作: Multiply (2) |
|
Screen |
高度な OpenGL ブレンディング操作: Screen (2) |
|
Overlay |
高度な OpenGL ブレンディング操作: Overlay (2) |
|
Darken |
高度な OpenGL ブレンディング操作: Darken (2) |
|
Lighten |
高度な OpenGL ブレンディング操作: Lighten (2) |
|
ColorDodge |
高度な OpenGL ブレンディング操作: ColorDodge (2) |
|
ColorBurn |
高度な OpenGL ブレンディング操作: ColorBurn (2) |
|
HardLight |
高度な OpenGL ブレンディング操作: HardLight (2) |
|
SoftLight |
高度な OpenGL ブレンディング操作: SoftLight (2) |
|
Difference |
高度な OpenGL ブレンディング操作: Difference (2) |
|
Exclusion |
高度な OpenGL ブレンディング操作: Exclusion (2) |
|
HSLHue |
高度な OpenGL ブレンディング操作: HSLHue (2) |
|
HSLSaturation |
高度な OpenGL ブレンディング操作: HSLSaturation (2) |
|
HSLColor |
高度な OpenGL ブレンディング操作: HSLColor (2) |
|
HSLLuminosity |
高度な OpenGL ブレンディング操作: HSLLuminosity (2) |
注:
GLES3.1 AEP+、GL_KHR_blend_equation_advanced、または GL_NV_blend_equation_advanced が必要です。これらは標準的な RGBA ブレンドで使用するときのみ使用可能で、RGB とアルファを別々にブレンドする場合には対応していません。Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Enable subtractive blending for this Pass
Blend SrcAlpha One
BlendOp RevSub
// The rest of the code that defines the Pass goes here.
}
}
}
このサンプルコードでは、SubShader ブロックでこのコマンドを使用するための構文を示しています。
Shader "Examples/CommandExample"
{
SubShader
{
// Enable subtractive blending for this SubShader
Blend SrcAlpha One
BlendOp RevSub
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}