Created
September 27, 2018 01:43
-
-
Save erodozer/1387b79776b2055a633fb4dd32533daf to your computer and use it in GitHub Desktop.
Transition Clamping Shader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
render_mode blend_mix; | |
uniform float transition: hint_range(0, 1); | |
float val(vec3 color) { | |
return max(max(color.r, color.g), color.b); | |
} | |
void fragment() { | |
vec4 sample = texture(TEXTURE, UV.xy); | |
if (val(sample.rgb) < transition) { | |
COLOR = vec4(0,0,0,0) | |
} else { | |
COLOR = vec4(0,0,0,1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment