Uniform floats being treated as 1.0

Godot Version

4.2.1

Question

When making a simple shader for a dynamic sine wave, any uniform variables are treated as 1.0, so changing them doesn’t effect the wave at all. I must be missing something very basic here.

shader_type spatial;
uniform float amplitude = 5.0;
uniform float frequency = 20.0;
uniform float speed = 2.0;

void vertex() {
	float phase = frequency * speed;
	VERTEX.y = amplitude * sin((VERTEX.x * frequency) + (TIME * phase));
}
1 Like

Tested on 4.2, works for me. What’s the issue for you?

Any change to the uniform floats doesn’t change the wave:

If you change the default Godot doesn’t reset the value for the opened scene, i believe. So you have to reset them in the inspector.

1 Like

Ah I see, didn’t realise I needed to use Shader Parameters. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.