offsetshadow.gdshader 333 B

1234567891011121314
  1. shader_type canvas_item;
  2. render_mode blend_mix;
  3. uniform vec2 offset = vec2(8.0, 8.0);
  4. uniform vec4 modulate : source_color;
  5. void fragment() {
  6. vec2 ps = TEXTURE_PIXEL_SIZE;
  7. vec4 shadow = vec4(modulate.rgb, texture(TEXTURE, UV - offset * ps).a * modulate.a);
  8. vec4 col = texture(TEXTURE, UV);
  9. COLOR = mix(shadow, col, col.a);
  10. }