Search Unity

Question Depth of Field stops working after creating UI camera

Discussion in 'High Definition Render Pipeline' started by ChristopherLIvey, Sep 24, 2022.

  1. ChristopherLIvey

    ChristopherLIvey

    Joined:
    Aug 31, 2022
    Posts:
    9
    I had my project working well rendering depth-of-field with a physical camera. Originally I had just pasted a canvas layer over the camera for UI elements, but this caused issues, so I moved all of my UI into the UI layer, and created a new orthographic camera that renders just that layer. Everything works great, except that depth of field is no longer rendered by the main camera in the scene. All of the other post-processing effects in that global volume, like ambient occlusion still work.

    From the attached images, you can see that I've cranked the depth of field effect to a ridiculous level, and it shows in the camera preview.

    However, as you can see from the game view, this effect isn't being applied at all.
    scene_view.png game_view.png

    I tried creating a new global volume just for the UI layer and applying it to the UI camera, but that has no effect on the rendered scene.

    What should I be doing differently?
     
  2. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    146
    HDRP afaik is designed around a single camera setup, I'd recommend to stick with that, multiple cameras can introduce a lot of issues such as the one you mentioned.
     
  3. ChristopherLIvey

    ChristopherLIvey

    Joined:
    Aug 31, 2022
    Posts:
    9
    Oh dear. I was setting things up to use cinemachine to blend between different views in the scene. You'd think you'd want to be able to apply the same volume to multiple cameras in a third-person game setup, which is a common enough scenario for HDRP...
     
  4. ChristopherLIvey

    ChristopherLIvey

    Joined:
    Aug 31, 2022
    Posts:
    9
    I removed the additional cameras, and simply set my UI canvas to render in screenspace - overlay. Lazy, but it works for now.
     
  5. Matjio

    Matjio

    Unity Technologies

    Joined:
    Dec 1, 2014
    Posts:
    108
    ElevenGame likes this.