Godot Version
4.7.1
Question
So I want to create a light shader on a sprite that only shows the light on a certain color (blue for testing purposes). I got this code so far but it isn’t working and I don’t understand why. Can someone help?
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, filter_nearest;
uniform vec3 mask_color : source_color;
uniform float mask_threshold : hint_range(0.0, 1.0) = 0.15;
void light() {
vec3 screen_rgb = texture(screen_texture, SCREEN_UV).rgb;
float is_mask_color = step(distance(screen_rgb, mask_color), mask_threshold);
LIGHT.rgb *= is_mask_color;
}