X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=vignette_effect.frag;fp=vignette_effect.frag;h=bc84516437685727301a7f512f0f9aba911cd724;hp=c7e1d6143785f2a5a484aadb7f955544945ebb6e;hb=74cdd144cf35c403d9a8a3f35420f1eaa3d84cc4;hpb=bc31a9072da1d9bfe417fd850e92cabe049fd593 diff --git a/vignette_effect.frag b/vignette_effect.frag index c7e1d61..bc84516 100644 --- a/vignette_effect.frag +++ b/vignette_effect.frag @@ -1,14 +1,15 @@ // A simple, circular vignette, with a cos² falloff. uniform float PREFIX(inv_radius); -varying vec2 PREFIX(normalized_pos); +uniform vec2 PREFIX(aspect_correction); vec4 FUNCNAME(vec2 tc) { vec4 x = LAST_INPUT(tc); const float pihalf = 0.5 * 3.14159265358979324; - float dist = (length(PREFIX(normalized_pos)) - PREFIX(inner_radius)) * PREFIX(inv_radius); + vec2 normalized_pos = (tc - PREFIX(center)) * PREFIX(aspect_correction); + float dist = (length(normalized_pos) - PREFIX(inner_radius)) * PREFIX(inv_radius); float linear_falloff = clamp(dist, 0.0, 1.0) * pihalf; float falloff = cos(linear_falloff) * cos(linear_falloff); x.rgb *= vec3(falloff);