Search Unity

Any way to prevent PP stack effects from working on world-space UI?

Discussion in 'Image Effects' started by Tomer-Barkan, Mar 8, 2019.

  1. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    We're using a bloom PP effect, and I would like to prevent it from affecting world-UI elements such as health bars, unit name texts, etc.

    I thought of rendering those in a separate camera after the PP, by using a layer mask, however I don't want it to be displayed on top of everything (so if a unit is behind a building, I wouldn't want to see their health bar).

    Is there a way to tell a secondary camera to use the depth buffer of the main camra? Or any other ideas on how to prevent a PP profile from affecting world-space UI elements?
     
    ModLunar likes this.
  2. Sh-Shahrabi

    Sh-Shahrabi

    Joined:
    Sep 28, 2018
    Posts:
    56
    If you set your second camera's flag on don't clear, and let it render after the main camera with the post process camera layer, your second camera will use the depth buffer rendered by the first camera for it's depth tests. Just make sure that both the cameras have the same near and far plane.
     
    ModLunar and Tomer-Barkan like this.
  3. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    Oh, thanks! I was sure that each camera had their own buffer and "Don't clear" meant to keep the same one from previous frames. But this makes more sense.