Version: Unity 6.0 (6000.0)
言語 : 日本語
シェーダーでのステンシルバッファの確認または書き込み
GPU がレンダリングする色チャンネルを設定する

シェーダーのブレンドモードの設定

Blend コマンドは、フラグメントシェーダーの出力を 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.
        }
    }
}

追加リソース

シェーダーでのステンシルバッファの確認または書き込み
GPU がレンダリングする色チャンネルを設定する
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961