Version: Unity 6.0 (6000.0)
言語 : 日本語
シェーダーのブレンドモードの設定
AlphaToMask モードでエイリアシングを軽減

GPU がレンダリングする色チャンネルを設定する

デフォルトでは、GPU はすべてのチャンネル (RGBA) に書き込みます。ただし、効果によっては特定のチャンネルを変更したくない場合があります。例えば、色のない影をレンダリングするためには、色のレンダリングを無効にします。もう 1 つの一般的な使用例は、色の書き込みを完全に無効にすることで、他のバッファに書き込まずに 1 つのバッファにだけデータを入力できるようにすることです。例えば、レンダーターゲットに書き込まずにステンシルバッファにデータを入力したい場合などです。

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

        Pass
        {    
              // Enable writing only to the RGB channels for this Pass, which disables writing to the alpha channel
              ColorMask RGB

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

このサンプルコードでは、SubShader ブロックでこのコマンドを使用するための構文を示しています。

Shader "Examples/CommandExample"
{
    SubShader
    {
         // Enable writing only to the RGB channels for this SubShader, which disables writing to the alpha channel
         ColorMask RGB

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

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

追加リソース

シェーダーのブレンドモードの設定
AlphaToMask モードでエイリアシングを軽減