Hi all, so I’ve recently updated my project to URP, and while the performance gains have been great, I’ve ran into this issue.
At the moment, my scene (3D) is built with multiple cameras, in order from bottom-most to top-most
0-Background Camera (this renders the game background)
1-Midground Camera (this renders objects between the player and the Background)
2-Player Camera (This renders the player related stuff)
Now, before starting using Camera Stacking, I used to have:
0-Background Camera, environment set to Color (or whatever)
1-Midground, set to Depth Only
2-Player, Set to Depth Only
So the Player Camera renders the player stuff, behind it the Midground cam renders the stuff behind, and at the bottom the BG camera renders a background.
I used to have a Depth of Field post fx applied in a Global Volume which worked well, but since trying to setup the scene the same way with Stacking, I can’t get this the focus distance to work anymore.
Here’s how I stacked my cameras:
-Background Cameras (base)
-Midground (overlay)
-Player (overlay)
since as far as I understood, it’s the only way I can get the same camera layering?
However, since this setup (and Post fx is applied to all 3 cameras), my Depth of Field’s Focus Distance doesn’t work anymore, as it seems to now only seem to focus at near infinity or really high focus distance value. This both in Bokeh and Gauss modes for all objects relying on the overlay cameras.
Do Overlay cameras stop writing to the depth buffer or something similar?
If you want to try it yourself, just create 3 cubes at 3 different distances, 1 camera set to Base, and a global volume with Depth of Field set. Then create a second camera, set your cubes to render only from that camera, and make that camera an Overlay stacked on top of the other base camera. Depth of field becomes defocused and (especially noticeable in bokeh mode) the focus distance doesn’t seem to work anymore.
Using Unity 2020.3.1f1
Anyone had the same issue?
Thank you!
EDIT: So it seems that once a camera is in Overlay, Post Process active and has 3d geometry rendering on it, the Depth of Field Focal Distance MUST be set at that camera’s Far Clipping Plane value. doesn’t really make sense to me? Am I arranging things wrong?