Skip to content
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

Shader uniforms cannot be keyframed into an animation #24690

Open
sicienss opened this issue Jan 1, 2019 · 8 comments
Open

Shader uniforms cannot be keyframed into an animation #24690

sicienss opened this issue Jan 1, 2019 · 8 comments

Comments

@sicienss
Copy link

sicienss commented Jan 1, 2019

Godot version:
3.1 alpha 4 (downloaded from here)

OS/device including version:
Windows 8, Toshiba Satellite

Issue description:
Clicking the keyframe icon next to a shader parameter in the inspector does not keyframe the current value into the animation. It doesn't do anything.

It appears you cannot keyframe the shader itself or the render_priority either.

Steps to reproduce:

  1. Create a scene consisting of a Sprite with an AnimationPlayer child.
  2. Add a shader to the Sprite with some uniform.
  3. Try to key frame values of the uniform into an animation via the inspector.
  4. Observe that nothing happens when you click the keyframe icon next to the shader parameter.

Minimal reproduction project:
TestProject.zip

@Zylann
Copy link
Contributor

Zylann commented Jan 1, 2019

Actually, I think you can't keyframe stuff that isn't a node, i.e you cannot keyframe resources, and shader uniforms (aka ShaderMaterial) are one of them.

Resource properties have a keyframe icon shown next to them, but clicking it does nothing and prints an error.
If I try to keyframe a ShaderMaterial property:

ERROR: emit_signal: Error calling method from signal 'property_keyed': 'InspectorDock::_property_keyed': Method expected 3 arguments, but called with 1.
   At: core/object.cpp:1241

If I try to keyframe a CubeMesh size:

ERROR: emit_signal: Error calling method from signal 'property_keyed_with_value': 'EditorInspector::_property_keyed_with_value': Method expected 3 arguments, but called with 2.
   At: core/object.cpp:1241

I wonder if keyframing resources was initially intented though. One thing to be aware of when you do this is to be aware of which nodes have this resource in common, because resources can be shared.

@sicienss
Copy link
Author

sicienss commented Jan 1, 2019

Interesting. You definitely could keyframe shader parameters in Godot 3.0.6, and it's very handy to be able to do so.

My guess is the intended behavior is for you to be able to keyframe these. If not, it should be.

@Zylann
Copy link
Contributor

Zylann commented Jan 1, 2019

I just tried for ShaderMaterial in 3.0.6, and there is a twist:
if you just setup the shader, the default value in ShaderMaterial is null, and can't be keyframed either. But, if you manually click that property, and enter any value, it gets set to a non-null value, and only then, it CAN be keyframed.

This also happens in 3.1 alpha4, even though the inspector appears to show a default value. If you have a vec3 parameter, just set it to (1, 0, 0) for example, and then you'll see Godot will allow you to keyframe it when you click on the key icon.
It's very strange, could be related to #24488

@sicienss
Copy link
Author

sicienss commented Jan 1, 2019

Yeah, I noticed that in 3.0.6 as well. In 3.1, I have a float uniform that I just can't seem to get keyframed, even if I manually change the value from the default in the inspector.

I'm using hint_range(0, 1). I wonder if that has something to do with it. I'll keep experimenting.

@Chaosus Chaosus added this to the 3.1 milestone Jan 1, 2019
@danielpcs
Copy link

I am also facing that issue when trying to keyframe some settings in a ProceduralSky inside a WorldEnvironment node. A current workaround is to change the track name to what you need, in my case "WorldEnvironment:environment:background_sky:sky_top_color", it should work as intended after that.

I believe it might be related to how the new UI is set up, it might not be providing the correct values for the keyframe button, so anything that is not a direct property of the node or has more than one level (e.g. resource properties) won't work.

@KoBeWi
Copy link
Member

KoBeWi commented May 22, 2021

Reopening, the issue seems still present in 3.3.

  1. Add a shader
  2. Add a uniform with hint range
  3. Try keying it

Here's minimal project:
Shaderbug.zip
You get the same error as in second comment here. You can fix this by using the slider to set some value before animating it.

@KoBeWi KoBeWi reopened this May 22, 2021
@KoBeWi KoBeWi removed this from the 3.1 milestone May 22, 2021
@DIPANJAN01
Copy link

This bug still exits in v4.2.1
I think we SHOULD be able to animate uniform shader parameters.

@KoBeWi
Copy link
Member

KoBeWi commented Mar 20, 2024

I can't reproduce it in 4.3 with my previous attached project.
Do you have an up-to-date MRP for this bug?
Also based on my previous comment, it's only happening if the value is uninitialized (related #44454). Normally it is possible to animate shader parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants