fadein.gdshader 557 B

123456789101112131415161718192021
  1. shader_type canvas_item;
  2. render_mode unshaded;
  3. uniform float cutoff: hint_range(0.0, 1.0);
  4. uniform sampler2D mask: source_color;
  5. uniform float smoothSize : hint_range(0.0, 1.0);
  6. void fragment() {
  7. // Called for every pixel the material is visible on.
  8. float value = texture(mask, UV).r;
  9. float alpha = smoothstep(cutoff, cutoff+smoothSize, value);
  10. COLOR = vec4(COLOR.rgb, alpha);
  11. }
  12. //void light() {
  13. // Called for every pixel for every light affecting the CanvasItem.
  14. // Uncomment to replace the default light processing function with this one.
  15. //}