xiandie/asset/shader/vignette.gdshader

19 lines
641 B
Plaintext
Raw Normal View History

2024-12-23 01:31:10 +00:00
shader_type canvas_item;
2025-07-01 11:40:30 +00:00
uniform float vignette_ratio : hint_range(0.0, 1.0) = 0.4;
uniform float vignette_intensity : hint_range(0.0, 4.0) = 0.3;
uniform vec3 vignette_rgb : source_color = vec3(0.753, 0.0, 0.0);
2024-12-23 01:31:10 +00:00
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap;
float vignette(vec2 uv){
uv *= 1.0 - uv.xy;
float vignette = (uv.x + 0.05) * (uv.y + 0.05) * 15.0;
return pow(vignette, vignette_intensity);
}
void fragment(){
vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV);
2025-07-01 11:40:30 +00:00
float a = 1.0 - vignette(UV);
vec3 rgb = vignette_ratio * vignette_rgb + (1.0 - vignette_ratio) * color.rgb;
COLOR = vec4(rgb, a);
2024-12-23 01:31:10 +00:00
}