I’m pretty new to godot, but I’ve made a simple shader to change the colors of a sprite to other colors. I can confirm it works, as by changing the parameters while in the editor will have effects in runtime, however, setting the parameters in code via set_instance_shader_parameter() doesn’t seem to update the sprite? It does change the parameter, but doesn’t look like it changes the sprite.
The shader code:
shader_type canvas_item;
uniform vec4 color1 : source_color;
uniform vec4 color2 : source_color;
uniform vec4 color1map: source_color;
uniform vec4 color2map: source_color;
void fragment() {
// Called for every pixel the material is visible on.
if (COLOR == color1) {
COLOR = color1map;
}
else if (COLOR == color2) {
COLOR = color2map;
}
}
the docs are locked behind the github commit system.
they haven’t even updated AnimationTree, it says nothing about the useful expressions and it has pictures from godot 3.
but I saw a PR that will update it, hopefully soon.
2D instance shaders on the other hand, who know?