Version: Unity 6.0 (6000.0)
言語 : 日本語
シェーダーでの深度クリップモードの設定
シェーダーで深度バッファへの書き込みを無効にする

シェーダーでの深度テストモードの設定

深度テストは、“Early-Z” 機能を持つ GPU がパイプラインの早い段階でジオメトリを拒否することを可能にし、また、ジオメトリの正しい順序付けを保証します。また、深度テストの条件を変更することで、オブジェクトオクルージョンなどの視覚効果を実現します。

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

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

        Pass
        {    
              // Sets the depth test operation to Equal for all pixels in this Pass
              // You would typically do this if you want to render the geometry exactly where already rendered geometry is
              ZTest Equal
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

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

Shader "Examples/CommandExample"
{
    SubShader
    {
        // Sets the depth test operation to Equal for all pixels in this Pass
        // You would typically do this if you want to render the geometry exactly where already rendered geometry is
        ZTest Equal

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

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

追加リソース

シェーダーでの深度クリップモードの設定
シェーダーで深度バッファへの書き込みを無効にする