Is there a way to directly animate a shader uniform via AnimationPlayer or in some other way? If not, this is something to consider for the future versions as it'd be very useful. I know it can be done indirectly by animating a node property and manually sending it's value to the shader.
Animating shader uniforms
- Edited
You can create keyframes for shader params. Just have the animation tab selected and click the key button next to the uniform you want to create a keyframe for.
Depends what kind of animation you need. For simple stuff, just use the TIME built-in and some logic. For example, I made this video using only shaders (the scene had two non-moving flat planes). https://www.reddit.com/r/godot/comments/fb2tmh/experiment_with_vertex_shader_animation/
Oh, so it's possible. Godot keeps surprising me in pleasant ways :) I was trying to animate via tweens but didn't know there's a catch with path syntax. Now that I looked how AnimationPlayer specifies the path, all is clear. I tried:
:material_override:shader_param:uniform_name
Which didn't work. Proper syntax then is:
:material_override:shader_param/uniform_name
And it works with tweens too. Cool!
@cybereality it's not looped. Only one-shot eased transition that gets triggered sporadically and has different duration each time it happens. I do use TIME for looping stuff.
Thanks for the hints guys!