Chromatic aberration and vignette
Cheap lens-imperfection pass: sample red, green and blue at slightly different radial scales to fake lateral colour fringing, then darken toward the corners with a smooth radial falloff.
In the family Post-processing, color & imaging, lens effects
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | Official add-on | import { chromaticAberration } from 'three/addons/tsl/display/ChromaticAberrationNode.js' docs |
| Babylon.js 9.38.0 | Built in | pipeline.chromaticAberrationEnabled = true; imageProcessing.vignetteEnabled = true docs |
| Godot 4.7 | None found | No built-in chromatic aberration post-process on Environment; implement via CompositorEffect or a screen shader. |
| Unity | Built in | Volume > Add Override > Post-processing > Chromatic Aberration (and Vignette) docs URP and HDRP. |
| Unreal 5.7 | Built in | Post Process Volume > Lens > Chromatic Aberration > Intensity docs |
| Blender 5.2 | Built in | Compositor > Add > Camera Lens Effects > Chromatic Aberration (and Vignette) docs Compositor nodes, applied after rendering. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Lateral chromatic aberration is the wavelength-dependent magnification of a real lens. The shader computes the vector from the screen centre to the pixel, then reads the red channel at a slightly larger scale and the blue channel at a slightly smaller one, with green at the original position. The offset grows with distance from the centre, so the centre stays clean and fringes appear at edges. For smoother fringes, take several taps across the spectrum and weight them with a hue ramp. A vignette multiplies the result by a smooth function of the squared distance from centre, which can be aspect corrected and softened with a power or smoothstep. Both effects are applied late, in display space, after bloom and before grain.
When to choose it
Reach for it when
- image looks too clean and digital
- want colour fringing at screen edges like a real lens
- need cheap crt or cheap-lens look
- darken the corners to draw focus to the centre
Choose it for a subtle photographic or CRT feel, or to add edge-weighted attention.
Prefer a physically based lens flare or full lens simulation when accuracy matters. Apply before Film grain synthesis so the grain stays unaffected.
Field marks
- Too much looks like a cheap filter and softens fine UI or text
- Colour fringes on bright points exceed gamut after tonemapping if applied on HDR
- Aspect-ratio errors produce elliptical vignette
- Fringing becomes jaggy when the scene is not filtered or anti-aliased first
Presets
Radial fringing and vignette on a test pattern
{
"CA_STRENGTH": 0.03,
"VIG_STRENGTH": 0.55
}Show GLSL (32 lines)
// GLSL ES 3.0, Shadertoy-style
const float CA_STRENGTH = 0.03;
const float VIG_STRENGTH = 0.55;
vec3 scene(vec2 p) {
vec2 g = floor(p * 4.0);
float chk = mod(g.x + g.y, 2.0);
vec3 col = mix(vec3(0.12, 0.14, 0.18), vec3(0.85, 0.82, 0.74), chk);
float d = length(p - vec2(0.25 * sin(iTime), 0.0));
col = mix(col, vec3(1.0, 0.25, 0.15), smoothstep(0.42, 0.40, d));
float ring = abs(length(p) - 0.8);
col = mix(col, vec3(0.1, 0.6, 1.0), smoothstep(0.03, 0.02, ring));
col = mix(col, vec3(1.0), smoothstep(0.012, 0.008, abs(p.x)));
return col;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord / iResolution.xy;
vec2 p = (uv - 0.5) * 2.0;
p.x *= iResolution.x / iResolution.y;
float r2 = dot(p, p);
float k = CA_STRENGTH * r2;
vec3 col;
col.r = scene(p * (1.0 + k)).r;
col.g = scene(p).g;
col.b = scene(p * (1.0 - k)).b;
vec2 q = uv - 0.5;
float vig = 1.0 - VIG_STRENGTH * smoothstep(0.15, 0.75, dot(q, q) * 2.0);
col *= vig;
fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);
}
Attribution: written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| chromatic-aberration-vignette-default | Tesla T4 1920x1080 | 2.73× baseline (light) · 0.090 ms / 0.092 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| chromatic-aberration-vignette-default | NVIDIA L4 1920x1080 | 2.19× baseline (light) · 0.035 ms / 0.036 ms · 2.6× faster on L4 | opengl-timer-query · Cross-architecture validation |
| chromatic-aberration-vignette-default | NVIDIA A100-SXM4-40GB 1920x1080 | 1.87× baseline (feather) · 0.054 ms / 0.054 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Crosses
- Film grain synthesis: The lens pass runs first and grain is layered on top at the end.
Sources
- primaryUnity-Technologies (2016). Unity-Technologies/PostProcessing. Post Processing StackGitHub API · license NOASSERTION · archived · 2026-11-29
- implementationpmndrs (2015). pmndrs/postprocessing. A post processing library for three.js.GitHub API · license Zlib · 2026-11-29
- implementationmattdesl (2015). mattdesl/three-vignette-background. a simple ThreeJS vignette backgroundGitHub API · license MIT · 2026-11-29