Alpha-to-coverage モードは、植生シェーダーなど、アルファテストを使用するシェーダーで、マルチサンプリングアンチエイリアス (MSAA) を使用する場合に発生する過剰なエイリアシングを軽減することができます。これを実現するために、Alpha-to-coverage モードは、フラグメントシェーダー出力のアルファ値に比例させて、マルチサンプルカバレッジマスクを修正します。
このコマンドは MSAA との併用を想定しています。MSAA を使用せずに Alpha-to-coverage モードを有効にすると、予測しない結果になることがあります。これは、グラフィックス API や GPU によって処理が異なるためです。
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Enable alpha-to-coverage mode for this Pass
AlphaToMask On
// The rest of the code that defines the Pass goes here.
}
}
}
このサンプルコードでは、SubShader ブロックでこのコマンドを使用するための構文を示しています。
Shader "Examples/CommandExample"
{
SubShader
{
// Enable alpha-to-coverage mode for this SubShader
AlphaToMask On
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}