Godot Version
4.2.2.stable.mono
Question
Hello, I am trying to change the opacity of a mesh by changing its opacity through a shader.
Here is the shader
shader_type spatial;
render_mode depth_prepass_alpha;
uniform float opacity:hint_range(0.0, 1.0) = 1.0;
uniform sampler2D _abeldo:source_color;
void fragment() {
ALBEDO = texture(_abeldo, UV).rbg;
ALPHA = opacity;
}
I have function that sets opacity
public void SetOpacity()
{
mesh.SetInstanceShaderParameter("opacity", opacity);
}
but the opacity never changes.
If I print
mesh.GetInstanceShaderParameter("opacity", opacity);
It prints out the value I expect it to be, but that opacity is not reflected in the scene. I have no Idea why that would be, and if anyone can see a mistake that I am making please let me know.