UnityのURPにおけるポストエフェクト(Post-processing)のつけ方のメモ記事で、 内容としては、URPのドキュメントのPost-processingのHow to configureを訳す感じです。
Post-processing in the Universal Render Pipeline | Universal RP | 12.0.0
URPでもPostProcessingStackって使ってなかった?
URP(LWRP)ちょっと触ったって人はもしかすると、「URPでもPostProcessingStackって使ってなかった?」という認識を持っている方もいると思います。これに関しては、既に様々なところで変更があったことが言及されていますが、具体的にどの辺で変わったのかはドキュメントで確認することができます。
Render pipeline compatibility
This package is compatible with the following render pipeline versions:
Built-in render pipeline. Universal Render Pipeline (URP) 7.x, with Unity 2018 LTS, and 2019 LTS. Certain effects are not compatible with URP. Scriptable Render Pipeline (SRP).
要するに、URP7+Unity2019ぐらいまでは従来のPostProcessingStackを使っていて、URP8+Unity2020以降はURP独自実装されたPostprocessingを使うようになったってことですね。
URPを使ってみるというときに間違えて導入しないように注意しましょう。
新しく作成したシーンに使用する
新しく作成したシーンに対してCubeを置いただけのシーンを作成しました。
カメラの設定の変更
カメラのPostProcessingのチェックボックスにチェックを入れます。
ゲームオブジェクトにVolumeコンポーネントを追加
空のゲームオブジェクトVolumeを作成して、Volumeコンポーネントを追加します。
Volume Profileの作成
VolumeのProfileの右側にあるNewボタンから新しいProfileを作成します。
エフェクトを付ける
後はVolumeの下のAdd Overrideから色々とエフェクトを付けることができます。
色々とつけてみた
雑にエフェクトを沢山つけてみましたが、デフォルトのスカイボックスのデフォルト感が凄いですね!
モバイル向けの設定について
Post-processing effects can take up a lot of frame time. If you’re using URP for mobile devices, these effects are the most “mobile-friendly” by default:
- Bloom (with High Quality Filtering disabled)
- Chromatic Aberration
- Color Grading
- Lens Distortion
- Vignette
Note: For depth-of field, Unity recommends that you use Gaussian Depth of Field for lower-end devices. For console and desktop platforms, use Bokeh Depth of Field.
Note: For anti-aliasing on mobile platforms, Unity recommends that you use FXAA.
箇条書きされてる5つのエフェクトはモバイルでも大丈夫、depth-of fieldは弱いモバイルデバイスではGaussian、デスクトップやコンソールではBokehを使う、 モバイル向けの場合はアンチエイリアシングはFXAAを推奨。ってところでしょうか。
おわりに
現在のURPにおけるポストエフェクトのかけ方について触れました。 デバイス負荷とトレードオフですが、上手く使えると絵作りが良い感じになるので、活用していきたいですね。