I'm making a water shader, and it uses layered sine waves for waves. I copied the wave function into a script so I could align objects to the waves, but it isn't working. The problem is probably because of the TIME variable. In my script, I have some code

func _process(delta):
	t+=delta

t should be time, but will it be the same value as in the shader? If not, how can I get that value in a script?

Unfortunately, there is currently no way of getting the same TIME variable in the shader into GDScript.

A different approach would be to pass your own time variable to the shader. This has the added benefit that you can control the speed of the waves without it looking like it's swimming.

Yeah, I think I'll just use the time variable from the script in the shader. I just thought there might be a better way.

3 years later