はじめに
Youtubeの公式チャンネルにkeifiro神が以下の動画をあげていました。
動画も4分くらいなので正直そちらを見た方が良いかと思いますが、Fullscreen ShaderGraphについてブログにまとめておきます。
あとURPとHDRPに対応していますが、この記事ではURPのみ取り上げます。


環境
Unity 2022.2.0b16
やり方
Fullscreen ShaderGraphの作成
Create -> ShaderGraph -> URP -> Fullscreen ShaderGraphを選択します。


もしくはGraph InspecterのUniversal -> MaterialをFullscreenにしてください。

Universal Renderer assetにFull Screen Pass Renderer Featureを設定
作成したFullscreen ShaderGraphを適応するには、Universal Renderer assetのAdd Renderer FeatureからFull Screen Pass Renderer Featureを選択し、先ほど生成したShaderを適応したMaterialをセットしてください。
Universal Renderer | Universal RP | 15.0.2

ちなみにどのUniversal Renderer Assetを利用しているか分からない場合は、ProjectSettings -> Quality -> Rendering -> Render Pipeline Assetから使用しているRender Pipeline Assetを探し出し、InspectorからRendering -> Renderer Listに設定されているUniversal Renderer Dataを調べればOKです。


Full Screen Pass Renderer Featureのプロパティ
| プロパティ名 | 意味 |
|---|---|
| Name | Name of the Full Screen Pass Renderer Feature. |
| Pass Material | The Material the Renderer Feature uses to render the effect. |
| Injection Point | Select when the effect is rendered |
| Requirements | Select one or more of the following passes for the Renderer Feature to use |
| Pass Index | Select a specific pass inside the Pass Material's shader for the Pass Material to use. |
Full Screen Pass Renderer Feature | Universal RP | 14.0.3
Injection Pointはエフェクトが適応されるタイミングのことで、以下があります。デフォルトではAfter Rendering Post Processingですね。
- Before Rendering Transparents: Add the effect after the skybox pass and before the transparents pass.
- Before Rendering Post Processing: Add the effect after the transparents pass and before the post-processing pass.
- After Rendering Post Processing: Add the effect after the post-processing pass and before AfterRendering pass.
またRequirementsは以下があり、Colorがデフォルト値です。
- None: Add no additional passes.
- Everything: Adds all additional passes available (Depth, Normal, Color, and Motion).
- Depth: Adds a depth prepass to enable the use of depth values.
- Normal: Enables the use of normal vector data.
- Color: Copies color data of a screen to the _BlitTexture texture inside the shader.
- Motion: Enables the use of motion vectors.
公式ドキュメントに載っているUse the Material in a Full Screen Pass Renderer FeatureではAfter Rendering Post Processing+Colorになっています。
How to create a custom post-processing effect | Universal RP | 14.0.3
Pass Indexについては私も良く分かっていないので後で調べておきます。
URP Sample Bufferノード
スクリーンの色を取得する場合はURP Sample Buffer(BlitSource)ノードを使います。


