Interacting with Shaders

Problem

You want to interact with a Godot shader from GDScript.

Solution

To access the uniform’s value from GDScript, you can use set_shader_param() on the object’s material property. If the attached material is a ShaderMaterial, then you can access it like so:

node.material.set_shader_param("param_name", value)

You can also get the value with get_shader_param().

For an example of this, see the Blur Shader recipe.