update vignette calculation formula

This commit is contained in:
MihailRis 2024-06-13 23:37:29 +03:00
parent 63c2a4e5ca
commit ad5814060d

View File

@ -5,21 +5,20 @@ uniform sampler2D u_texture0;
uniform ivec2 u_screenSize; uniform ivec2 u_screenSize;
// Vignette // Vignette
vec4 apply_vignette(vec4 color) vec4 apply_vignette(vec4 color) {
{
vec2 position = (gl_FragCoord.xy / u_screenSize) - vec2(0.5); vec2 position = (gl_FragCoord.xy / u_screenSize) - vec2(0.5);
float dist = length(position); float dist = length(position);
float radius = 2.0; float radius = 1.3;
float softness = 1.7; float softness = 1.0;
float vignette = smoothstep(radius, radius - softness, dist); float vignette = smoothstep(radius, radius - softness, dist);
color.rgb = color.rgb - (1.0 - vignette); color.rgb = color.rgb * vignette;
return color; return color;
} }
void main(){ void main() {
f_color = texture(u_texture0, v_coord); f_color = texture(u_texture0, v_coord);
f_color = apply_vignette(f_color); f_color = apply_vignette(f_color);
} }