Pass ブロックはゲームオブジェクトのジオメトリを 1回レンダリングします。
Pass { [Name and Tags] [RenderSetup] }
基本的な Pass コマンドは、レンダリングステートの設定コマンドのリストを含んでいます。
Pass は Name と任意の数の Tags を定義します。これらは Pass の意図をレンダリングエンジンに伝達する name/value 文字列です。
Pass はさまざまなグラフィックスハードウェアの State (状態)を設定します、例えばアルファブレンディングを有効にするか、デプステストを使用するか、などです。
コマンドは以下のとおりです。
Cull Back | Front | Off
ポリゴンのカリングモードを設定。
ZTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always)
デプスバッファテストモードを設定。
ZWrite On | Off
デプスバッファ書き込みモードを設定。
Offset OffsetFactor, OffsetUnits
Z バッファのデプスオフセットを設定します。詳細は ShaderLab :カリングと深度テクスチャ ページを参照してください。
詳細は ShaderLab :カリングと深度テクスチャ ページを参照してください。
Blend sourceBlendMode destBlendMode
Blend sourceBlendMode destBlendMode, alphaSourceBlendMode alphaDestBlendMode
BlendOp colorOp
BlendOp colorOp, alphaOp
AlphaToMask On | Off
アルファブレンディング、アルファ操作、alpha-to-coverage モードを設定します。詳細は Blending を参照してください。
ColorMask RGB | A | 0 | any combination of R, G, B, A
マスクであるカラーチャネルの書き込みを設定します。_ColorMask 0_と記載することですべてのカラーチャネルのレンダリングを無効化します。 デフォルトモードは、チャンネル(RGBA)すべてに書き込みしますが、あなたが変更していない特定のチャンネルに残しておきたい特殊効果等がある場合または色 を無効にする場合は完全に記述します。
複数のレンダーターゲット (MRT) のレンダリングを行う場合は、最後にインデックス (0–7) を追加することによって、各レンダーターゲットに対して異なるカラーマスクを設定することができます。例えば、ColorMask RGB 3
は 3 番目のレンダーターゲッだけを RGB チャンネルに書き込みます。
数多くのコマンドが、旧「固定関数スタイル」シェーダーを作成するために使用されます。サーフェスシェーダー や シェーダープログラムを作成するほうがずっと柔軟性があるため、固定関数スタイルは、非推奨と考えられます。 ただし、とても簡易なシェーダーに関しては、固定関数スタイルでそれらを作成するほうがより簡単なこともあります。そのため、コマンドがここに紹介されています。固定関数シェーダーを使用していない場合は、以下のコマンドはすべて無視されます。
Lighting On | Off
Material { Material Block }
SeparateSpecular On | Off
Color Color-value
ColorMaterial AmbientAndDiffuse | Emission
これらはすべて、頂点ライティングの固定関数を制御します。頂点ライティングの作動、マテリアルの色の設定、スペキュラーハイライトの作動、デフォルト色の設定 (頂点ライティングがオフの場合)を行い、メッシュの頂点色がライティングへ及ぼす影響を制御します。詳細は マテリアルを参照してください。
Fog { Fog Block }
固定関数フォグパラメータを設定します。詳細は ShaderLab: Fog(旧)のページを参照してください。
AlphaTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always) CutoffValue
アルファテストを有効にします。詳細は ShaderLab: 旧 Alpha Testingのページを参照してください。
レンダリングステートの設定後に、SetTexture のコマンドを使用してテクスチャ数と合成モードを指定します。
SetTexture textureProperty { combine options }
シェーダーパスは Unity のレンダリングパイプラインにいくらか影響します。例えば、Tags コマンドを使って、deferred shadingによってのみパスを使うように指定することができます。パスによっては、同じオブジェクト上で複数回実行することもできます。例えば、forward renderingでは、いくつのライトがゲームオブジェクトに影響しているかによって、“ForwardAdd” パスが複数回実行されます。
詳細は レンダリングパイプラインを参照してください。
いくつかの特別なパスで、共通的な機能の再利用やハイエンドのエフェクトの実装が利用可能です。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.