-
Notifications
You must be signed in to change notification settings - Fork 855
Fixing color input to gamma correct #1413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
com.unity.shadergraph/Editor/Data/Graphs/AbstractShaderProperty.cs
Outdated
Show resolved
Hide resolved
public abstract class AbstractShaderProperty : ShaderInput | ||
{ | ||
|
||
public virtual int latestVersion { get; } = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be static and override-able, but I am having a brain fart on the way to do that
com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs
Outdated
Show resolved
Hide resolved
… deprecated warnings when flag is checked, and allow creation of both deprecated and latest color properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments (any questions I didn't answer I don't know =) ).
The "Enable Depredation" checkbox also needs to be added to our docs on a "Preferences" page (I think one exists but it should if it doesn't =) ).
com.unity.shadergraph/Editor/Data/Graphs/ColorShaderProperty.cs
Outdated
Show resolved
Hide resolved
com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs
Outdated
Show resolved
Hide resolved
…tests, and minor bugfix
Updating documentation
|:-------------|:------|:------------| | ||
| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | | ||
|
||
NOTE: Previous versions actually interpreted the color in linear space. The behavior is corrected now, and previously created color properties will continue to use old behavior unless explicilty upgraded through the [Graph Inspector](Internal-Inspector.md). You may use a **Vector 4** property or convert a new **Color** property back to linear space with the [Colorspace Conversion Node](Colorspace-Conversion-Node.md) to mimic old behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion is to move this note higher up (before Default) to make it clearer that this note applies to all color properties. Also, here's my re-write. I'm waiting for Liz to confirm that the info is correct.
NOTE: Previous versions actually interpreted the color in linear space. The behavior is corrected now, and previously created color properties will continue to use old behavior unless explicilty upgraded through the [Graph Inspector](Internal-Inspector.md). You may use a **Vector 4** property or convert a new **Color** property back to linear space with the [Colorspace Conversion Node](Colorspace-Conversion-Node.md) to mimic old behavior.
…ady, move version to be serialized in JsonObject, fix color property and node to behave correctly with HDR values
com.unity.shadergraph/Editor/Data/Nodes/AbstractMaterialNode.cs
Outdated
Show resolved
Hide resolved
com.unity.shadergraph/Editor/Drawing/Inspector/PropertyDrawers/ShaderInputPropertyDrawer.cs
Outdated
Show resolved
Hide resolved
…ng search window provider ability to support deprecated node creation if preference is on, and updated Node Views to update title if the node is a deprecated version
Noted in the document but I want to mention here too, I think that the upgrade button should be there regardless of whether "enable deprecated nodes" is enabled. Having that enabled doesn't necessarily mean that the user doesn't want to upgrade nodes, especially in cases where they want to be able to create deprecated versions for some nodes but want to upgrade other nodes. |
I'm finding that there is not enough warning to the user that upgrading the deprecated node will change the resulting color/emission level. Users might not mouse over the warning and there are cases that you can not always see a change in the shadergraph master preview, so the user might upgrade, then do a bunch of additional work (so they can't undo), then go to the scene and see that the emission level has changed. I feel like we need to rethink how we do this warning, perhaps have a popup explaining that this will change the resulting color/emission if it's HDR, and the user may need to fine tune the color again to get the old result. We may want to make such pop up standard for any upgrade that causes a noticeable change in functionality. |
We don't want users to be confused but I think the tooltip on the node, the message in the inspector, and info in the upgrade guide is sufficient. No matter what we do someone will miss it. I'm OK with it as-is. |
…le Deprecated is turned on in preferences.
I'd like to edit the documentation (have reached out to Liz about this), and wouldn't mind looking over the tooltip/Inspector message too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My last concern of being able to update the node while deprecated nodes are enabled in preferences, was addressed.
…logies/Graphics into sg/deprecate-property-color
Hmm... did a quick test and I can't open any shadergraphs. Exception thrown while invoking [OnOpenAssetAttribute] method 'UnityEditor.ShaderGraph.ShaderGraphImporterEditor:OnOpenAsset (int,int)' : NullReferenceException: Object reference not set to an instance of an object |
(but it works in the master I merged in) .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good! If you backport to 9.0, need to make sure that all instances of "10.0" are changed to "9.0".
Fixed in latest! |
Needed a way to deprecate the Color Property and Color Node as painlessly as possible. Made system to handle deprecation/upgrading, as well as explicit override to allow previous version usage.
Color property deprecation - exposed HDR color properties are passed through without modification to shader. Need to be corrected. Color picker assumes linear space, so assume HDR color properties are in linear space, and conditionally convert to gamma based on project.
Color node deprecation - Inline colors were always assumed to be in gamma space, and conditionally were converted to linear space. HDR colors are already in linear space, so fixed conditional space conversion.
Modified input nodes test in test project to test (HDR and Default) inline color node, regular color property, and deprecated color property