@Name: Vignette
@Version: 1.0
@Description: Applies a vignette effect by darkening the corners of the image based on distance from the center.
@Reference: https://en.wikipedia.org/wiki/Vignetting
// Custom parameters that appear in the editor
@Strength: 1.0
@StartRadius: 0.5
@Power: 1.0
// Your GLSL fragment shader code snippet here.
// The sampler "input_tex" provides the input texture holding the output from the previous pass.
// vec2 "uv" holds normalized coordinates.
// vec4 "input_color" holds the color from input_tex at uv coordinates.
// int "width" and "height" uniforms hold the image dimensions in pixels.
// Modify vec4 'output_color' - its final value is the output pixel.
vec2 ar = vec2(float(width) / float(height), 1.0);
float distance = max(0.0, length(ar*(uv - vec2(0.5, 0.5))) - @StartRadius);
float vignette = @Strength * pow(distance, @Power);
float mask = 1.0 - vignette;
output_color = vec4(input_color.rgb * mask, input_color.a);