vignette.gdshader 394 B

1234567891011
  1. shader_type canvas_item;
  2. uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
  3. uniform sampler2D vignette;
  4. void fragment() {
  5. vec3 vignette_color = texture(vignette, UV).rgb;
  6. // Screen texture stores gaussian blurred copies on mipmaps.
  7. COLOR.rgb = textureLod(screen_texture, SCREEN_UV, (1.0 - vignette_color.r) * 4.0).rgb;
  8. COLOR.rgb *= texture(vignette, UV).rgb;
  9. }