ゲームのレンダリング中にできるだけ多くの深度情報を保存して、追加のデータを使用してより高度なさまざまな画面空間効果を実行できるようにしています。このブレンド モードでは、深さの並べ替えを維持しながら、通常のレンダリング中に最大 4 つの深さチャネルを保存できます。
ブレンド モードは、次の sudo コードのように機能します。
Cascade Blend mode:
R channel
If there is something in the green channel and nothing in the red channel, draw to the channel.
G channel:
If there is something in the blue channel and nothing in the green channel, draw to the channel.
B channel:
If there is something in the alpha channel and nothing in the blue channel, draw to the channel.
A channel
If there is nothing in the alpha channel, draw to the channel.
これの実装は次のようになります。
dest_r = src_r * (ceil(dest_g) - ceil(dest_r));
dest_g = src_g * (ceil(dest_b) - ceil(dest_g));
dest_b = src_b * (ceil(dest_a) - ceil(dest_b));
dest_a = src_a * (1.0 - ceil(dest_a));
ブレンド モードはフラグメント シェーダーのようにコードで直接変更できないため、既存の技術を使用してブレンド モードでこのようなことが実現できないか興味があります。何千ものオブジェクトがレンダリングされる可能性があるため、マルチ シェーダー パスを実行するのは非現実的です。現在のフレーム バッファーをコピーして、オブジェクトをレンダリングするたびにシェーダーに戻す必要があります。