Simple color invert area.

Can use with either sprite , textureRect , ColorRect. It will preserve transparent pixel and invert color of anything below it.

Shader code
shader_type canvas_item;

void fragment(){
	
	vec4 color = vec4(texture(SCREEN_TEXTURE, SCREEN_UV).rgb, texture(TEXTURE, UV).a);
	
	COLOR = vec4(1.0 - color.rgb,  color.a);
}
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Invert Color

Invert color

Simple blur, mixed with a color

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments