Files
Five-Nights-At-Akers/Shaders/static_blocky.gdshader
2026-03-24 12:56:35 -07:00

22 lines
649 B
Plaintext

shader_type canvas_item;
// Parameters
uniform float alpha_threshold : hint_range(0.0, 1.0) = 0.1; // below this = fully transparent
uniform float alpha_modifier : hint_range(0.0, 1.0) = 1.0; // global alpha multiplier
void fragment() {
// Sample the current frame automatically
vec4 tex_color = texture(TEXTURE, UV);
// Convert color to luminance (grayscale)
float lum = dot(tex_color.rgb, vec3(0.299, 0.587, 0.114));
// Apply threshold: if below threshold, alpha = 0
float alpha = lum < alpha_threshold ? 0.0 : lum;
// Apply global modifier
alpha *= alpha_modifier;
COLOR = vec4(tex_color.rgb, alpha);
}