Search Unity

Bug Color difference in default URP Lit shader between

Discussion in 'Graphics for ECS' started by Mirath, Jul 28, 2022.

  1. Mirath

    Mirath

    Joined:
    Aug 5, 2012
    Posts:
    15
    Hiya,
    I'm just starting out working with DOTS and am testing out the URP with the Hybrid Renderer. I've noticed a color difference between two objects sharing the same material using the URP Lit shader. One is a standard Unity object, the other is in a subscene and converted to an Entity. When the subscene is unchecked or in playmode, the object renders differently as shown below, with the Entity version less saturated. This also is the case with lighting disabled in the scene.
    Has anyone encountered this and know of any solution? Ideally the same material will render the same between the two options, in case either approach is needed when used in-game. Any help or insights is greatly appreciated!
    Thanks,
    Ben

    upload_2022-7-28_18-0-22.png
     
  2. Anthiese

    Anthiese

    Joined:
    Oct 13, 2013
    Posts:
    73
    Perhaps your project color space is set to gamma? You need to set that to linear if it’s not already.
     
  3. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    A known issue with overriding material properties via DOTS components is that the override system is unable to do sRGB to linear conversion automatically. When overriding color values using IComponentData, you need to use linear color values in the components, which can be obtained using e.g. the Color.linear API.

    This should happen automatically if you're not using component overrides, as long as the project color space is set to linear.
     
    Occuros likes this.
  4. Mirath

    Mirath

    Joined:
    Aug 5, 2012
    Posts:
    15
    Good call, it was indeed because the color space was still set to Gamma. Thanks a bunch!
     
    JussiKnuuttila likes this.