Blend コマンドで使用されるブレンディング操作を指定します。このコマンドが効果を発揮するためには、同じ Pass ブロック (このコマンドが Pass ブロック内にある場合) または SubShader ブロック (このコマンドが SubShader ブロック内にある場合) に Blend コマンドが存在する必要があります。
すべてのデバイスですべてのブレンド操作がサポートされているわけではなく、サポートはグラフィックス API とハードウェアの両方に依存します。グラフィックス API によって、サポートされていないブレンディング操作の扱いは異なります。GL はサポートされていない操作をスキップし、Vulkan と Metal は Add 操作にフォールバックします。
機能名 | ビルトインレンダーパイプライン | ユニバーサルレンダーパイプライン (URP) | HD レンダーパイプライン (HDRP) | カスタム SRP |
---|---|---|---|---|
BlendOp | 可 | 可 | 可 | 可 |
このコマンドは、レンダー状態の変更を行います。Pass
ブロックで使用すると、そのパスのレンダー状態を設定することができます。また、SubShader
ブロックで使用すると、そのサブシェーダー内のすべてのパスのレンダー状態を設定することができます。
シグネチャ | 構文例 | 機能 |
---|---|---|
BlendOp <operation> |
BlendOp Sub |
Blend コマンドで使用するブレンド操作を設定します。 |
パラメーター | Value | 機能 |
---|---|---|
operation | Add |
同時にソースとデスティネーションを追加します。 |
Sub |
ソースからデスティネーションを減算します | |
RevSub |
デスティネーションからソースを減算します | |
Min |
Use the smaller of source and destination. (1) | |
Max |
Use the larger of source and destination. (1) | |
LogicalClear |
Logical operation: Clear (0) (1) |
|
LogicalSet |
Logical operation: Set (1) (1) |
|
LogicalCopy |
Logical operation: Copy (s) (1) |
|
LogicalCopyInverted |
論理演算: Copy inverted (!s) (注 2 参照) |
|
LogicalNoop |
Logical operation: Noop (d) (1) |
|
LogicalInvert |
Logical operation: Invert (!d) (1) |
|
LogicalAnd |
Logical operation: And (s & d) (1) |
|
LogicalNand |
Logical operation: Nand !(s & d) (1) |
|
LogicalOr |
Logical operation: Or (s | d) (1) |
|
LogicalNor |
Logical operation: Nor !(s | d) (1) |
|
LogicalXor |
Logical operation: Xor (s ^ d) (1) |
|
LogicalEquiv |
Logical operation: Equivalence !(s ^ d) (1) |
|
LogicalAndReverse |
Logical operation: Reverse And (s & !d) (1) |
|
LogicalAndInverted |
Logical operation: Inverted And (!s & d) (1) |
|
LogicalOrReverse |
Logical operation: Reverse Or (s | !d) (1) |
|
LogicalOrInverted |
Logical operation: Inverted Or (!s | d) (1) |
|
Multiply |
Advanced OpenGL blending operation: Multiply (2) |
|
Screen |
Advanced OpenGL blending operation: Screen (2) |
|
Overlay |
Advanced OpenGL blending operation: Overlay (2) |
|
Darken |
Advanced OpenGL blending operation: Darken (2) |
|
Lighten |
Advanced OpenGL blending operation: Lighten (2) |
|
ColorDodge |
Advanced OpenGL blending operation: ColorDodge (2) |
|
ColorBurn |
Advanced OpenGL blending operation: ColorBurn (2) |
|
HardLight |
Advanced OpenGL blending operation: HardLight (2) |
|
SoftLight |
Advanced OpenGL blending operation: SoftLight (2) |
|
Difference |
Advanced OpenGL blending operation: Difference (2) |
|
Exclusion |
Advanced OpenGL blending operation: Exclusion (2) |
|
HSLHue |
Advanced OpenGL blending operation: HSLHue (2) |
|
HSLSaturation |
Advanced OpenGL blending operation: HSLSaturation (2) |
|
HSLColor |
Advanced OpenGL blending operation: HSLColor (2) |
|
HSLLuminosity |
Advanced OpenGL blending operation: HSLLuminosity (2) |
注:
GLES3.1 AEP+
, GL_KHR_blend_equation_advanced
, or GL_NV_blend_equation_advanced
. They can only be used with standard RGBA blending; they are not compatible with separate RGB and alpha blending.Shader "Examples/CommandExample"
{
SubShader
{
// SubShader を定義する残りのコードをここに記述
Pass
{
// Enable subtractive blending for this Pass
Blend SrcAlpha One
BlendOp RevSub
// Pass を定義する残りのコードをここに記述
}
}
}
このサンプルコードでは、SubShader ブロックでこのコマンドを使用するための構文を示しています。
Shader "Examples/CommandExample"
{
SubShader
{
//この SubShader の減法ブレンディングを有効にします
Blend SrcAlpha One
BlendOp RevSub
// The rest of the code that defines the SubShader goes here.
Pass
{
// Pass を定義する残りのコードをここに記述
}
}
}
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.