0 votes

I've played around with shaders (never done shaders before, so i'm total noob).
I've build a "hyperjump" shader, that i want to assign to as sprite, when the starship sprite leaves my scene.

Inside the (graphical) shader i use "time".
Now i have the effect that, even if the material is not assigned to the sprite yet, the time seems to go on.

So when i finally assign the material, the shader "does not start at the beginning".
So my question is now: Can i somehow set the shader time to 0 on assignment?

in Engine by (107 points)

1 Answer

+2 votes
Best answer

Use a float uniform instead of TIME and, with a script or AnimationPlayer, modify the value on process.

Is really easy to animate shaders with animationplayer, via code you can change shader parameters getting the material and using set_shader_param

by (7,908 points)
selected by

Thanks! Totally missed this!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.