Using Post Processing Volumes in Unity3D with the URP
In my last article, I covered global post processing volumes and a few of the various FX that can be applied to your scene. In this article, I will show how to use different local post processing volumes in one game scene.
If you are using Unity 2020 and above, you might notice that adding a component to the main camera and searching for the Post Processing Layer will not yield any results. This is because the new Unity URP (Universal Render Pipeline) is no longer compatible with their old post process pipeline. This is good though, because using the new volumes method requires less steps than the previous method, and you don’t have to add any layers to the camera.
I already have a global post process volume in my scene, so let’s add a local Box Volume. Using a Box, Sphere or Convex Mesh volume will change what your scene looks like, so long as the main camera is inside the collider of the Volume.
The Transform is reset to be zero across all axes, and I title the first one Cool Box Volume.
There is no Profile assigned, so I create one by pressing the New button.
I now have a cool box volume profile in my assets folder.
In order for the post processing effects to be visible, you need to enable Post Processing on the main camera, under Rendering.
In order to view and change the size of the new cool post process volume, you have to select the volume in the hierarchy, and then press the Edit Collider button in the Box Collider component, in the Inspector.
Now the central points on each side of the box collider can be dragged to resize the box.
I want this collider to cover the entire entrance to the game scene. This is quickly accomplished using the orthographic view to align my collider edges.
Back in perspective mode, here is the edited collider taking up the entire space of the entrance hallway.
Now post processing effects, also seen here as overrides, can be added to the Box Volume. I just want to change the overall color of the scene, so I add the Color Adjustments override.
Enable the Color Filter option, then click the HDR color button and choose a new color in the pop-up color widget.
I choose a very saturated blue, mainly to show an extreme take on a cool environment volume. As you can see, the Scene view looks normal because I am currently outside of the box volume. The Game view looks blue because the Main Camera is inside the box volume.
I create another box volume for the main large room. This one will be the warm volume.
A warm box volume profile is generated just like the cool profile.
The color adjustments override is added to the warm volume, and a saturated red is selected for the color filter.
Now there is a foreboding environment!
Moving between the volume colliders changes the appearance of the game scene.
Each collider has a Blend Distance, which will give a fade effect as the player moves through the game scene. I change this level to zero on both colliders to show an extreme transition.
With the blend distance on zero, the color change snaps immediately as soon as I move from one collider to the other.
Here they both have a blend distance of 5 or so, which shows a much smoother transition between volume profiles.
For this Gif, I adjusted the color and saturation on the two profiles to to be less aggressive, added in the first person controller and then manually moved between volume colliders in the scene.
I hope to see you in my next article, and thanks for reading!