-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Rename hint_albedo for sRGB -> Linear color conversion in shaders #2323
Comments
I'd like to elaborate a little as I seem to have triggered this proposal. This problem occurs from the point of view of someone who is familiar with linear and sRGB color spaces and graphics programming, but is new to writing non-visual shaders in Godot. In many graphics pipelines an sRGB hinting mechanism as this does not exist and won't be anticipated. Terminology issues: "hint" - problematic in the implication that the effect is trifling and not worth my time to ponder. This proposal was needed because a change to the keyword would break old projects. Therefore we need a discussion. I suggest the following: (1) New keywords (whatever is finally chosen by the bikeshed senate) be introduced that have the same behavior. |
We'd rather have only one way to achieve a given result, rather than multiple ways to achieve the same result. Personally, I would name the hint just
If we change this keyword before Godot 4.0 is released, we can remove the old keyword for 4.0 🙂 |
This comment has been minimized.
This comment has been minimized.
If the lead developers are comfortable with breaking old projects over this, I have no objection. I just thought that was the point of the discussion. |
We probably want to bikeshed the entire list, though, since they will want to have an internally consistent set of names: hint_color, for example, probably implies that vec4 color uniforms are also sRGB. But I actually don't know (which is the problem).
|
A few more victims: https://godotengine.org/qa/35289/unusual-color-ramping-on-shadermaterial-textures-help The reason I went to this effort is because akien and reduz godotengine/godot#24992 (comment) have given the impression that they believe things are fine as they are, which diminishes the chances of this proposal being successful. |
I think that is a good idea. I suggest the following renames/additions
|
We discussed this in a proposal meeting and agreed to the following changes:
|
@Calinou and what doing with a |
I think |
I really don't understand this name change. The issue people are having seems to be with texture color space conversion. If the intention was to make things more intuitive, this is my opinion a catastrophic failure. As a newcomer just as much as a seasoned Godot user, when I to define a uniform color to show up as a color-pickable color-button in the Inspector, I think of hints. Why? because a hint is what this is! After the colon I give the editor a hint on how to interpret the value after the = "hint" is what we have in the export variables in GDScript too. They fulfill the exact same purpose. "hint" is what the other shader uniform hints are called too. For this reason they still have the word "hint_" as prefix. I spend the bigger part of my life with graphics and I still don't understand what "source" could possibly mean in the context of a vec4 color Using "source_color" instead "hint_color" for vec3 vec4 color-pickable color-button uniforms does absolutely nothing at all to help users with the srgb color space texture issue. All this does is to introduce more inconsistency and making hints harder to guess (therefore less intuitive!) |
@golddotasksquestions the problem lies in the fact that the This was a very common source of error as the comments in this proposal highlight. I understand that getting used to the new name is frustrating for users like yourself who have already figured out the nuance of stuff like this in 3.x. But for new users it is very important that we are clear and consistent and we don't hide important functionality behind unintuitive names. I'm confident that you will get used to the new name with time. |
@clayjohn Thanks for the explanation, very much appreciated! But it seems I have actually not at all figured out those nuances. I have reread the new documentation a few times now, and tried to understand what you mean here in your last comment, I understood the first part, but I still don't understand the second part of what I am aware about srgb-liniar color space conversion when it comes to texture, but how is this relevant when using hint_color uniform vec3 vec4 (so no sampler2D)? What's even more confusing for me now is how "hint_" prefix is used for sampler2D uniforms ... |
It does the same thing, it ensures that the color is in the appropriate color space when read in the shader. For spatial shaders it ensures that the color is linear while for 2D shaders it ensures that the color is in sRGB.
For sampler2D uniforms the hint_ prefix tells the engine what the texture will be used for so the engine can either provide a good default or expose it nicely in the editor (like exposing a slider for range etc.) But the hint_ does not change the value that you read from the texture |
Thanks! I think I now understand how this name change came to be, but I still think it's a terrible choice and failure at making naming more consistent and therefore easier to remember and more intuitive. |
Describe the project you are working on
A landscape visualization using a variety of custom shaders; this is not project-specific though.
Describe the problem or limitation you are having in your project
As is evident in the comments of the original issue for this and other posts such as godotengine/godot#11381 or https://godotdevelopers.org/forum/discussion/19049/custom-splatmap-shader-does-not-work-correctly-in-3-0-solved, many people (myself included) are initially confused by the sRGB -> Linear color space conversion in shaders, which is done as follows:
The updated docs do make this clearer, but a
hint_
still isn't where many people would intuitively search for when the 'colors look wrong'. In my experience, throughout the engine, 'hints' are usually something that make development easier, e.g. by providing better autocompletion or by exposing something to the editor in a more convenient way. It's unusual for a hint to be required for producing a correct output.In order to make shaders slightly more approachable, I propose renaming this to something that is more obvious to newcomers.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Rename the keyword. Simply
uniform sampler2D tex : albedo;
would already be better in my opinion; something likeuniform sampler2D tex : color_srgb;
may be even more intuitive. This would be easy to do, but it'd break compatibility.I suppose this could also be handled completely differently, but it's just a minor issue with no need for a big restructure.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
These are just some of my ideas, maybe someone else can come up with something better.
If this enhancement will not be used often, can it be worked around with a few lines of script?
The default behavior will still be no conversion.
Is there a reason why this should be core and not an add-on in the asset library?
The functionality of converting a texture from sRGB to Linear is already in the engine, this is just a rename of that.
The text was updated successfully, but these errors were encountered: