Physically-based chromatic aberration model
This post is actually a translation and adaptation of my original article . What is chromatic aberration? Chromatic aberration [1] is a failure of a lens to focus all colors to the same point. It is caused by dispersion: the refractive index of the lens elements varies with the wavelength of light. That is how a prefect lens works: As you can see, all the colors are focused at the same point. There are 2 types of chromatic aberration: longitudinal (axial) and lateral (transverse). Longitudinal chromatic aberration occurs when different colors have different focal planes. Meanwhile, the lateral chromatic aberration contains all the colors on the same focal plane but with a little shift. Describing all the further algorithms, I assume that we have only lateral chromatic aberration. Implementation Common algorithm You can find the most popular algorithm implemented in my shadertoy account. //Chromatic aberration parameters #define CA_STRENGTH 15.0 vec3 Chromat...