Screen Space Camera canvas is being affected by the depth of field blur

The screen space camera canvas is being affected by the depth of field blur if there is no depth written close by.

The depth of field has manual ranges set up like this:

  • near range: 0-1
  • far range: 15-25

and the screen space canvas is set to be at 9.5 units from the camera, so it should be totally in focus.

But the result is looking like this:

I tested it in 2022.3.38 and 6000.0.23 (HDRP in both cases) and it behaves the same.

I already submitted a bug report (as I always do) but maybe there is any known workaround for such a thing?

Hi, bro. You can try use two differents cameras to render diferents layers. On the UI camera you dont use PostProcess (or just DOF blur).

I beg to differ. I am using HDRP so it is not viable(performance wise) solution.

Not idea solution, but you can build up a simple HDRP/Canvas shadergraph to display your ui elements, and this should properly handle the depth of canvas elements.

Will it work in 2022.3? I thought that ui shader graphs are only Unity 6+.

Indeed, the UI target is not available in 2022.3.
One solution would be to use a Custom Pass. Set the canvas objects in a dedicated layer (let say, the unmodifiable layer 5 “UI” ), not visible from the camera culling mask, but drawn with a “Draw Renderers Custom Pass” in the After Post Process injection point.