Search Unity

UI Camera Affects Depth of Field when turned on

Discussion in 'High Definition Render Pipeline' started by Mantra-Games, Jul 9, 2021.

  1. Mantra-Games

    Mantra-Games

    Joined:
    Nov 27, 2012
    Posts:
    169
    I have a main camera, cinemachine camera and a UI camera.

    I also have a Sky and Fog volume and a Global volume with a bunch of post processing including Depth of Field. These 2 layers are marked as "Volumes"

    The issue is when I turn on the UI camera layer, the depth of field changes to blurring the whole screen. When I turn off the UI camera, the depth of field is fine.

    My Main camera's Volume Layer Mask is set to "Volumes".

    I'm using Manual Depth of Field here, "Use Physical Camera" doesn't even work when I play with the Physical camera settings on the main camera.

    Volume Layer Mask
    I've played with the Volume layer mask on the UI camera. When I change the layer to "Default", the post processing is fine except it gets all blurry because of the DoF, when I say "Nothing" it turns off the post processing and when I say "Volumes" the camera is even more messed up.

    TLDR - How do I have my UI camera not affect any post processing when turned on? Only Depth of Field is causing an issue.

    Thanks!
     
  2. Mantra-Games

    Mantra-Games

    Joined:
    Nov 27, 2012
    Posts:
    169
  3. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    720
    I've had problems with this. If you have multiple cameras running, the last camera's frame settings will override the prior cameras' settings. This is particularly problematic for tonemapping

    I could get around this in the editor by using the Compositor, but it produces very low-resolution results in builds, for some reason (see https://forum.unity.com/posts/7237502/ )

    I've been trying to get around this by just using custom render passes to draw the UI after the post-processing step, but it seems to be getting the sorting order backwards as a result -- text is rendering behind buttons, for example.

    (edit: turns out I had bad sorting settings! setting it to "Common Transparent" fixed that)
     
    Last edited: Jul 21, 2021
  4. meadjix

    meadjix

    Joined:
    Dec 31, 2014
    Posts:
    11