shader_type canvas_item; render_mode unshaded; uniform float cutoff: hint_range(0.0, 1.0); uniform sampler2D mask: source_color; uniform float smoothSize : hint_range(0.0, 1.0); void fragment() { // Called for every pixel the material is visible on. float value = texture(mask, UV).r; float alpha = smoothstep(cutoff, cutoff+smoothSize, value); COLOR = vec4(COLOR.rgb, alpha); } //void light() { // Called for every pixel for every light affecting the CanvasItem. // Uncomment to replace the default light processing function with this one. //}