Files
MaidEngine/shaders/chroma_key.gdshader
2026-04-04 22:16:35 -04:00

14 lines
329 B
Plaintext

shader_type canvas_item;
uniform vec4 key_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
uniform float threshold : hint_range(0.0, 1.0) = 0.01;
void fragment() {
vec4 tex_color = texture(TEXTURE, UV);
float dist = distance(tex_color.rgb, key_color.rgb);
if (dist < threshold) {
discard;
}
COLOR = tex_color * COLOR;
}