Invert color
A simple shader which invert the colors of an object.
Shader code
shader_type canvas_item;
void fragment(){
vec4 color = texture(TEXTURE, UV);
COLOR = vec4(1.0 - color.rgb, color.a);
}
A simple shader which invert the colors of an object.
shader_type canvas_item;
void fragment(){
vec4 color = texture(TEXTURE, UV);
COLOR = vec4(1.0 - color.rgb, color.a);
}
Unfortunately this didn’t work for me as I’d hoped; It filled in the transparent parts of the image with white.
This did work for me though:
Thank you for pointing this out! I’ve updated the code so now it should do what you expect. The new code does pretty much what you do in your example, but a bit more compact.
Great, thank you!