MaterialProperty color override incorrect results

Two cubes with the same unlit material, right one with a material property override with the same color values. At runtime the overridden one is lighter.

8190048--1067571--upload_2022-6-8_18-57-30.png

The material property overrides are unable to do automatic sRGB conversion for colors. Unfortunately, currently if you want the color to match, I think you have to store the color values in linear space to the IComponentData.

I think in your case, using material property values of (0.163, 0.296, 0.787), which is the linear space equivalent of the sRGB color (0.44, 0.58, 0.9) should hopefully produce a matching result.

You can convert between the two using the Unity APIs Color.linear and Color.gamma.

3 Likes

Thanks for the explanation :slight_smile: Those APIs will be put to good use ^^

Thanks, I’ve also encountered the exact same issue ( and thought I was going insane ). I’ll try out the linear conversion.

1 Like