Search Unity

Question Benefits of HDRP UI Camera Stacking?

Discussion in 'High Definition Render Pipeline' started by mroshaw, Sep 29, 2022.

  1. mroshaw

    mroshaw

    Joined:
    Oct 11, 2020
    Posts:
    47
    Hi! I'm still quite new to Unity and HDRP, so apologies if this is a daft question.

    I've just seen the HDRP UI Camera Stacking package on Github and am wondering what benefits there are to using it in my project:

    https://github.com/alelievr/HDRP-UI-Camera-Stacking

    My project uses a number of third party assets, and as a result my UI is generally made up of several Canvases on multiple game objects within a scene, and in player prefab instances that I spawn. Currently, all Canvases render to Screen Space and UI layer which is rendered on the Main Camera.

    Is there a performance gain or penalty from using the UI Stacking Camera solution?

    I learned early on, when trying to build a minimap tool, that HDRP FPS is hit hard when a second camera is introduced. My main motivation for tweaking my project at the moment is to max out performance. If UI Camera Stacking would help, then I'm keen to adopt it. If it has a negative impact, I'd like to understand the benefits so I can decide whether to include it.

    Again, quite new so I'm probably missing all sorts of details and nuances of HDRP, Cameras, UIs, etc, so please be gentle!

    Thank you!
     
  2. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    265
    Hello,

    As you said, the performance hit when adding a new camera rendering the scene is big in HDRP. The UI Camera Stacking package tries to solve this issue by rendering the UI during the rendering of the main camera and then compositing back at the end. That being said if you are not using a specific camera to render the UI in your game, then this package is pretty much useless (except if you have UI clipping in the world or temporal artifacts in your UI).

    Looking at the description of your scene, you don't have a camera to render the UI so unless you're experiencing some visual artifacts due to the way the UI is rendered with the post processes, then you don't need it.
     
  3. mroshaw

    mroshaw

    Joined:
    Oct 11, 2020
    Posts:
    47
    Great, thank you so much for the info!