It’s hard for me to believe, but it seems impossible to make depth-of-field work (blurring the distance) in 2D games with URP. This seems like such a basic/important visual (which makes Hollow Knight and many other games look great). Here is my experience:
If you use a depth-of-field post-processor in 2D, it just blurs everything. The Gaussian/bokeh knobs don’t work (see this thread ). The workaround that people seem to use is to make two separate cameras (one for background and one for everything else), and apply depth-of-field post processing to only the background camera. This achieves the goal pretty nicely for non-URP games.
But in URP you can’t do multiple camera rendering EXCEPT “Base” and “overlay”. For the background-blur effect, you need a background camera, not an “overlay” camera in front, which is the only option. I don’t think you can move the Overlay to be behind the Base (and if you can, it would be a hack since Overlay is designed for being in front). This was easily doable before URP with the “depth” property, but that’s gone now as shown in the unity docs.
Has anyone figured out a way to do this? I can’t find any working example and it’s frustrating. Thanks.
Already came to the same conclusion and I just think it’s just CRAZY that there is still no solution for this.
Unity was kind of proud to say about Hollow Knight “hey, look at gorgeous we can make a game in Unity with basic technics, so imagine what you will be able to do with our new gen pipeline !”
Well, Team Cherry was very lucky (or clever) to work with the Built In Renderer ! xD
Nope, they actually used a gaussian blur FX as you may think, they used a mesh plan with a blur shader right behind the player plan, in front of every background assets.
But at that time the Built In renderer was used and there was a lot of great shaders available on the assetstore for this pipeline…
Hi, maybe I’m late and you already figured out another way to achieve the effect you are looking for. I had the same issue trying to achieve the depht of field effect, and as you say the problem is that the overlay camera renders in front of the Base camera; so I simply added another overlay camera that renders everything (except for the background) and you can define which camera render on top of the other. I found this helpfull: https://www.youtube.com/watch?v=Svrn7DbWg3c
(just watch from minute 17:20)