I want to modulate my animated sprite (a pixel art slime/blob thingy), but keep the eyes and some white highlighting intact. I've been told I need to write a shader. My experience with writing shaders is very limited.
My initial intuition was to pass a binary mask image as a uniform, where all the pixels I want to modulate are set to 1 (white) and the ones I want to keep unchanged are set to 0. This is what I've come up with so far:
shader_type canvas_item;
uniform sampler2D mask;
uniform vec4 modulate: source_color;
void fragment() {
vec4 color = texture(TEXTURE,UV);
vec4 color_mask = texture(mask, UV);
if (color_mask.rgb != vec3(0.0))
color *= modulate;
COLOR = color;
}
but it doesn't do what I want it to. So my question is how do I achieve the coloring that I've described above?