X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=vignette_effect.frag;h=e8d185f6165f912b325fd61e3caef7e4c8cd5b68;hp=54fafffca138342f8aa1f33993862a02eefe201f;hb=974b5c837c24179f9ab29f4ffdcdd1172288172b;hpb=24660d2111d0ee97228016a7072304ff657d297b diff --git a/vignette_effect.frag b/vignette_effect.frag index 54fafff..e8d185f 100644 --- a/vignette_effect.frag +++ b/vignette_effect.frag @@ -1,14 +1,17 @@ // A simple, circular vignette, with a cos² falloff. - -uniform float PREFIX(pihalf_div_radius); -uniform vec2 PREFIX(aspect_correction); + +// Implicit uniforms: +// uniform float PREFIX(pihalf_div_radius); +// +// uniform vec2 PREFIX(aspect_correction); +// uniform vec2 PREFIX(flipped_center); vec4 FUNCNAME(vec2 tc) { vec4 x = INPUT(tc); const float pihalf = 0.5 * 3.14159265358979324; - vec2 normalized_pos = (tc - PREFIX(center)) * PREFIX(aspect_correction); + vec2 normalized_pos = (tc - PREFIX(flipped_center)) * PREFIX(aspect_correction); float dist = (length(normalized_pos) - PREFIX(inner_radius)) * PREFIX(pihalf_div_radius); float linear_falloff = clamp(dist, 0.0, pihalf); float falloff = cos(linear_falloff) * cos(linear_falloff);