2023-09-23 23:12:54 -07:00
|
|
|
shader_type canvas_item;
|
|
|
|
|
|
|
|
uniform float vignette_intensity = 0.4;
|
|
|
|
uniform float vignette_opacity : hint_range(0.0, 1.0) = 0.5;
|
|
|
|
uniform vec4 vignette_rgb : source_color = vec4(0.0, 0.0, 0.0, 1.0);
|
|
|
|
|
|
|
|
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
|
|
|
|
|
2024-03-25 23:46:24 -07:00
|
|
|
float vignette(vec2 uv) {
|
2023-09-23 23:12:54 -07:00
|
|
|
uv *= 1.0 - uv.xy;
|
|
|
|
float vignette = uv.x * uv.y * 15.0;
|
|
|
|
return pow(vignette, vignette_intensity * vignette_opacity);
|
|
|
|
}
|
|
|
|
|
2024-03-25 23:46:24 -07:00
|
|
|
void fragment() {
|
2023-09-23 23:12:54 -07:00
|
|
|
vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV);
|
|
|
|
vec4 text = texture(TEXTURE, UV);
|
|
|
|
|
|
|
|
text.rgba *= (vignette_rgb.rgba);
|
|
|
|
text.rgba *= (1.0 - vignette(UV));
|
|
|
|
|
2024-03-25 23:46:24 -07:00
|
|
|
COLOR = vec4((text.rgb) * color.rgb, text.a);
|
2023-09-23 23:12:54 -07:00
|
|
|
}
|