Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Canvas images become darker when switching from Screen Space - Overlay to Screen Space - Camera

Discussion in 'High Definition Render Pipeline' started by bwwinnec, Jul 20, 2022.

  1. bwwinnec


    Jun 12, 2019
    Hey there,

    I noticed in HDRP that when switching a canvas from Screen Space - Overlay to Screen Space - Camera any images on that canvas become slightly but noticeably darker.

    Demonstrated on a fresh HDRP project with a blank image on a canvas, this white square is how I want it to look when the canvas is set to Screen Space - Overlay:


    But when switching the canvas to Screen Space - Camera, the square becomes slightly darker:


    Is there any way to prevent this from happening?

    Thanks for your help!
  2. bwwinnec


    Jun 12, 2019

    Is there any solution for this, or is this just a limitation for canvases in HDRP?
  3. seoyeon222222


    Nov 18, 2020
    ScreenSpace Camera and WorldSpace are similar to 3d objects in real space.

    This is what happens because it's affected by the environment.

    Let me give you a simple example.
    Change the volume exposure, color adjustment, etc.
    You can see that the canvas changes under their influence.
    However, using ScreenSpace Overlay mode is not affected.
    Examples of using these UIs in HDRP can be found in other articles and manuals in the forum.

    There are several ways to ensure that the UI is not affected by the environment.

    1. Use ScreenSpace Overlay

    2. CustomPass
    Examples related to UI using CustomPass can be found in other articles in the manual or forum.
    If the injection point is set to After PostProcess, PostProcessing is not affected.

    3. Configure a controlled environment
    This is the way I'm using it as a detour.
    Not valid in all cases.

    Create a dark room for the UI in a specific distant space of the scene.
    Override the local volume to configure the space so that the UI in that space works the way I want it to.
    If the camera is in that space, the UI will appear as intended.
    It's a detour that works only in certain cases.
  4. joshuakery


    Apr 13, 2018
    I was experiencing this problem, where in HDRP a white UI element on a screen-space Canvas was appearing gray. I was using a Volume as well, possibly complicating the problem, as my sky was never it's full color either and it seems the Volume's exposure and a property called lens imperfection affect that. See here for a discussion about that.

    But for solving the problem when it comes to a Canvas, I found this thread to be helpful:

    Why is white not white in Screen Space Camera UI?

    From that thread: "Update: it has to do with the Volume Mask settings of the camera component. If I exclude the default layer from the Volume Mask, then it renders correctly"