Swap Color

Shader code
shader_type canvas_item;

uniform vec4 new : source_color;

void fragment() {
	vec4 current_pixel = texture(TEXTURE,UV);
	vec4 current_pixel2 = texture(TEXTURE,UV);
	if (current_pixel == current_pixel2)
		COLOR.rgb = new.rgb * current_pixel.g; 
	else
		COLOR = current_pixel;
}
Live Preview
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.

More from Timesi

Related shaders

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
denis23x
1 year ago

Hi ๐Ÿ‘‹ I used this shader for my first Godot game! Please check it out

https://denis23x.itch.io/deepwood 

I’ve linked you in the game description, in the game itself and in the game repository, thanks for the materials you provided ๐Ÿ™

https://github.com/denis23x/deepwood