-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Keying the initial value of a shader parameter inserts Variant::Nil
and the animation does not work as expected
#87040
Comments
Looks like the warning comes from #83030 originally (4.2) I don't understand why having a StringName for a key would stop a value from being updated continuously as the underlying value is not a string, its just using a string to access a member CC @TokageItLab |
I remember there was an issue somewhere about a shader parameter outputting a Variant type that was incorrectly determined (I recall it was an issue regarding the shader parameter inspector, but I can't remember where it is), and I think this issue is related to that. |
@TokageItLab What is confusing me is that we are checking the "key" and not the "value". It seems like the issue is that the "key" is a string/variant, even though the value we are trying to use is a number. |
@clayjohn I do not know where you are referring to. Can you cite a specific code? Probably related issue about guessing the type of shader parameters: |
@TokageItLab Here we are forcing the track to non-continuous because the key value is a StringName (as far as I can tell): godot/scene/animation/animation_mixer.cpp Lines 859 to 863 in 3524346
The user says they are using a float value, but they are still running into the warning because the check appears to look at the key instead of the value (which is a float) |
Are you getting a StringName in |
As expected, the problem was that the exported shader parameter was Nil if it is initial value. As noted in #75125 (comment), as long as it is an initial value, the Variant type is not properly assigned, so keying to the initial value seems to insert Nil. When the value is changed in AnimationKeyEdit, the proper type is assigned and it works fine. This can be fixed by caching the Nil key in the AnimationMixer cache so that if another key has a type, it takes precedence over it, but this is a hack. This is clearly a bug in the uniform parameter of shader language, as mentioned in the comments, and other problems are occurring elsewhere than in Animation, so the fix must be made on the shader language side. |
Variant::Nil
and the animation does not work as expected
Thanks for taking a deeper look! I'll check out the shader side and see if we find a solution |
Tested versions
System information
Godot v4.3.dev1 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.3734) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)
Issue description
In production game we noticed that shader parameters are not animated inside a game but looked OK in editor. Instead of interpolating values are set to values saved in a material resource.
As I was creating a reproduction project it was totally off in editor where it acted as discrete values on a float uniform.
4.2 I noticed a warning about shader float value
scene/animation/animation_mixer.cpp:879 - AnimationMixer: 'test', Value Track: '.:material:shader_parameter/red' uses a non-numeric type as key value with UpdateMode.UPDATE_CONTINUOUS. This will not be blended correctly, so it is forced to UpdateMode.UPDATE_DISCRETE. (User)
4.1.1 it looked correct for
uniform float alpha
until I introduceduniform float red
and its value wasn't animated.Steps to reproduce
Minimal reproduction project (MRP)
Animate Shader Parameters 4.1.zip
Animate Shader Parameters 4.1.1.zip
Animate Shader Param 4.2.zip
Animate SHader Bug 4.2.1.zip
Animate Shader Bug 4.3dev.zip
The text was updated successfully, but these errors were encountered: