13 lines
No EOL
412 B
Text
13 lines
No EOL
412 B
Text
shader_type canvas_item;
|
|
uniform sampler2D mask; // a texture
|
|
uniform float progress : hint_range(0.0, 1.0, 0.001);
|
|
|
|
void fragment() {
|
|
float mask_value = texture(mask, UV).r;
|
|
|
|
// ensure the progress is a bit bigger than the feather
|
|
float threshold = progress * 1.001;
|
|
|
|
// Fade alpha based on mask vs. threshold with a feather
|
|
COLOR.a *= smoothstep(threshold, threshold * 0.999, mask_value);
|
|
} |