According to this post from Unity Roadmap site, alpha processing for post processing has been shipped with Unity 6, meaning depth is now preserved while using 2D renderer, meaning using Depth of Field post-processing must be possible now in 2D projects out of the box. It has also mentioned below use cases:
Depth of Field in Layered Environments: Ideal for side-scroller games with multiple layers, allowing for advanced visual effects that selectively blur and focus elements across layers without impacting each other.
I haven’t had any success yet to make it work. I don’t know what I’m doing wrong. If it can be done, having depth of field in 2D games with 2D renderer becomes piece of cake (now it’s very painful). Has anyone done this? Or can please someone from the team clarify on this?
They recently added Depth of Field graphics test for the Renderer2D. Four days age there was a set of GitHub commits merged into the master branch for the Graphics repo.
Not sure if that means they are considering it feature ready yet though or planning to do more changes before it is ready for users. Link below to the GitHub commit that added the tests for it. So maybe try this week’s version of Unity 6 preview when it comes out and see if it is in there.
Sorry for double post but saw one Unity dev mentions the Unity 6 preview 22 will be the Unity Editor with the next set of Graphics repo commits merged into it not this week’s preview 21.
He mentioned it in the forum for the Introduction to the Render Graph. I don’t know what all is in it, but there are some changes for 2D renderer and some of them are added tests to the Depth of Field for 2D rendering.
There was also a bug mentioned about it where the wrong settings were trying to be set for Non-HDR set cameras and HDR set cameras, so you might of just ran into that bug causing it not to work for you.
This sounds like it is related to the massive set of depth stencil and depth texture bugs there were found. Basically when Unity 6 preview 22 comes out you should try that one and see if the bug fixes and changes to it makes it work in your project.
Link to the post the Unity dev mentioned when the Graphics updates will land for you so you can read it for yourself.