Hi!
I just made a new, empty shader. I use 2 colors to define the albedo of a mesh. For some reason, I get different results when the colors are constant or property!
Results when the colors are constants.
Results when the colors are properties.
To reiterate, the only thing I changed is the color type (Constant to Property). Am I misunderstanding something here?
I'm using unity 2018.2.9f1
Thanks!
Different colors when using constant or property values
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Different colors when using constant or property values
Hello, thank you for getting in touch and for your support!
This behavior is expected and it only happens in Linear color space, which is due to Unity trying to convert the property's value. It won't happen if the value is a constant, since the value is directly specified in the shader, or if you work in Gamma color space, which hopefully are valid workarounds.
Please let me know if you have any further questions, thanks!
This behavior is expected and it only happens in Linear color space, which is due to Unity trying to convert the property's value. It won't happen if the value is a constant, since the value is directly specified in the shader, or if you work in Gamma color space, which hopefully are valid workarounds.
Please let me know if you have any further questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Different colors when using constant or property values
Oh! I actually did not know that.
Thank you for the swift and kind reply
Thank you for the swift and kind reply

- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Different colors when using constant or property values
No problem, please don't hesitate to get in touch if you have any further questions, we'll be happy to help!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
- Posts: 9
- Joined: Thu Aug 16, 2018 2:43 pm
Re: Different colors when using constant or property values
I'm encountering the same thing and it's causing issues when building to mobile, so how do we use Property mode in linear color space?
EDIT: I'll be more specific here. The color nodes work fine when working in linear space, but the floats do not. I've been replacing floats with greyscale color nodes but I would really like to understand what's going on.
EDIT: I'll be more specific here. The color nodes work fine when working in linear space, but the floats do not. I've been replacing floats with greyscale color nodes but I would really like to understand what's going on.
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Different colors when using constant or property values
Hello, the conversion between linear and gamma is expected to only occur in color properties.
However, the float node does have a Gamma attribute that, according to Unity's documentation, might perform the necessary conversion.
Please let us know if the above does work, otherwise you'll likely have to use the color node rather than the float node.
However, the float node does have a Gamma attribute that, according to Unity's documentation, might perform the necessary conversion.
Please let us know if the above does work, otherwise you'll likely have to use the color node rather than the float node.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
- Posts: 9
- Joined: Thu Aug 16, 2018 2:43 pm
Re: Different colors when using constant or property values
Yes, that worked! Thanks for finding this, now it's clear. A build to iOS with a float node with the Gamma attribute is identical to a color node. I found the same info on a link from the page you posted, worded slightly differently:
https://docs.unity3d.com/Manual/SL-Properties.html:
"For properties that are marked as Float or Vector type, no color space conversions are done by default; it is assumed that they contain non-color data. It is possible to add [Gamma] attribute for float/vector properties to indicate that they are specified in sRGB space, just like colors."
https://docs.unity3d.com/Manual/SL-Properties.html:
"For properties that are marked as Float or Vector type, no color space conversions are done by default; it is assumed that they contain non-color data. It is possible to add [Gamma] attribute for float/vector properties to indicate that they are specified in sRGB space, just like colors."
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Different colors when using constant or property values
No problem, thank you for letting us know this worked out for you!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!