Vignette
This is part of the WebGL image processing series and it relies on information in previous articles. See all articles here.
It is designed to be used on desktop.
What is vignetting?
Vignetting is the reduction of an image's brightness or saturation towards its edges. While this was historically an undesired effect in photography – an indicator of incorrect camera settings or issues with the lens – it can also be used to lead the viewer's eye to a specific point on an image.
We look at code from Tyler Lindberg's glsl-vignette here, which is licensed on a MIT license.
In its simplest form we can take the distance from the center of the image and create a radial gradient that darkerns towards the edges. I've included an additional preview of the vignette over a white background to get a complete picture of the vignette's shape.
Smoothstep
The main issue with the above approach is that we lose a lot of detail from the center of the image. We can use smoothstep to control how smooth the fade is between our image and the darkness at the edges.
Vignette shape
We can also use separate values for our width and height to control the shape of our vignette.
In the next article, we'll be exploring how to simulate the effect of chromatic aberration.