X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=vignette_effect.frag;h=54fafffca138342f8aa1f33993862a02eefe201f;hp=422b27fd654b40d646ff13af5a2af566c834a524;hb=24660d2111d0ee97228016a7072304ff657d297b;hpb=e655afd53f2e56938bd4e7f72640eff56ef4a1ee diff --git a/vignette_effect.frag b/vignette_effect.frag index 422b27f..54fafff 100644 --- a/vignette_effect.frag +++ b/vignette_effect.frag @@ -1,6 +1,6 @@ // A simple, circular vignette, with a cos² falloff. -uniform float PREFIX(inv_radius); +uniform float PREFIX(pihalf_div_radius); uniform vec2 PREFIX(aspect_correction); vec4 FUNCNAME(vec2 tc) { @@ -9,8 +9,8 @@ vec4 FUNCNAME(vec2 tc) { const float pihalf = 0.5 * 3.14159265358979324; 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 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); x.rgb *= vec3(falloff);