Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Macryc |
Hi All. I have a simple shader where that uses Sampler2d with a noise texture.
In gdscript, I want to animate the offset parameter on the noise. I’m using this code:
func _physics_process(delta):
time += delta
print(self.material.get_shader_param("noise_img/noise/offset:x"))
self.material.set_shader_param("noise_img/noise/offset:x", time)
It prints correctly - the x offset parameter seems to be going up as expected. However, the noise is completely static. When I slide the x offset parameter in the editor, the noise is moving fine. The above code is not doing anything in runtime though, except print the correct value.
Interestingly, if use this:
print(self.material.get_shader_param("noise_img").noise.offset.x)
to print the param, it remains static (unaffected by the set_shader_param
).
It looks like it’s not really assigning the value to the param after all?
BTW, not sure it matters but the shader itself is a fog() shader in Godot 4.