1 // A simple, circular vignette, with a cosĀ² falloff.
3 uniform float PREFIX(inv_radius);
4 uniform vec2 PREFIX(aspect_correction);
6 vec4 FUNCNAME(vec2 tc) {
9 const float pihalf = 0.5 * 3.14159265358979324;
11 vec2 normalized_pos = (tc - PREFIX(center)) * PREFIX(aspect_correction);
12 float dist = (length(normalized_pos) - PREFIX(inner_radius)) * PREFIX(inv_radius);
13 float linear_falloff = clamp(dist, 0.0, 1.0) * pihalf;
14 float falloff = cos(linear_falloff) * cos(linear_falloff);
15 x.rgb *= vec3(falloff);