{
 "id": "chromatic-aberration",
 "title": "Chromatic aberration and vignette",
 "aliases": [],
 "domain": "post",
 "subdomain": "lens effects",
 "stage": "post",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "unity",
  "unreal",
  "godot"
 ],
 "year_introduced": 2010,
 "inputs": [
  "hdr-image",
  "ldr-image"
 ],
 "outputs": [
  "ldr-image"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "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.",
 "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_use": "Choose it for a subtle photographic or CRT feel, or to add edge-weighted attention.\n\nPrefer a physically based lens flare or full lens simulation when accuracy matters. Apply before `film-grain-synthesis` so the grain stays unaffected.",
 "cost": {
  "class": "cheap",
  "notes": "One pass with three or a few more fetches."
 },
 "failure_modes": [
  "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"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "gh:unity-technologies/postprocessing",
   "type": "code",
   "title": "Unity-Technologies/PostProcessing",
   "description": "Post Processing Stack",
   "authors": [
    "Unity-Technologies"
   ],
   "year": 2016,
   "venue": "GitHub",
   "url": "https://github.com/Unity-Technologies/PostProcessing",
   "ids": {
    "repo": "Unity-Technologies/PostProcessing"
   },
   "license": "NOASSERTION",
   "extra": {
    "stars": 3744,
    "stars_checked": "2026-11-29",
    "archived": true,
    "fork": false,
    "pushed_at": "2024-06-05T07:45:22Z",
    "language": "C#",
    "homepage": null,
    "license_name": "Other"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Unity-Technologies/PostProcessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Unity-Technologies/PostProcessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Unity-Technologies/PostProcessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Unity-Technologies/PostProcessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Unity-Technologies/PostProcessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Unity-Technologies/PostProcessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "unitytechnologies2016unity"
  },
  {
   "role": "implementation",
   "key": "gh:pmndrs/postprocessing",
   "type": "code",
   "title": "pmndrs/postprocessing",
   "description": "A post processing library for three.js.",
   "authors": [
    "pmndrs"
   ],
   "year": 2015,
   "venue": "GitHub",
   "url": "https://github.com/pmndrs/postprocessing",
   "ids": {
    "repo": "pmndrs/postprocessing"
   },
   "license": "Zlib",
   "extra": {
    "stars": 3009,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-22T15:27:35Z",
    "language": "JavaScript",
    "homepage": null,
    "license_name": "zlib License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/pmndrs/postprocessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/pmndrs/postprocessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/pmndrs/postprocessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/pmndrs/postprocessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/pmndrs/postprocessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/pmndrs/postprocessing",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "pmndrs2015pmndrs"
  },
  {
   "role": "implementation",
   "key": "gh:mattdesl/three-vignette-background",
   "type": "code",
   "title": "mattdesl/three-vignette-background",
   "description": "a simple ThreeJS vignette background",
   "authors": [
    "mattdesl"
   ],
   "year": 2015,
   "venue": "GitHub",
   "url": "https://github.com/mattdesl/three-vignette-background",
   "ids": {
    "repo": "mattdesl/three-vignette-background"
   },
   "license": "MIT",
   "extra": {
    "stars": 124,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2016-10-24T16:52:25Z",
    "language": "JavaScript",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mattdesl/three-vignette-background",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mattdesl/three-vignette-background",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mattdesl/three-vignette-background",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mattdesl/three-vignette-background",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mattdesl/three-vignette-background",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mattdesl/three-vignette-background",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "mattdesl2015mattdesl"
  }
 ],
 "presets": [
  {
   "id": "chromatic-aberration-vignette-default",
   "title": "Radial fringing and vignette on a test pattern",
   "runtime": "glsl-fragment",
   "params": {
    "CA_STRENGTH": 0.03,
    "VIG_STRENGTH": 0.55
   },
   "code": "// GLSL ES 3.0, Shadertoy-style\nconst float CA_STRENGTH = 0.03;\nconst float VIG_STRENGTH = 0.55;\n\nvec3 scene(vec2 p) {\n    vec2 g = floor(p * 4.0);\n    float chk = mod(g.x + g.y, 2.0);\n    vec3 col = mix(vec3(0.12, 0.14, 0.18), vec3(0.85, 0.82, 0.74), chk);\n    float d = length(p - vec2(0.25 * sin(iTime), 0.0));\n    col = mix(col, vec3(1.0, 0.25, 0.15), smoothstep(0.42, 0.40, d));\n    float ring = abs(length(p) - 0.8);\n    col = mix(col, vec3(0.1, 0.6, 1.0), smoothstep(0.03, 0.02, ring));\n    col = mix(col, vec3(1.0), smoothstep(0.012, 0.008, abs(p.x)));\n    return col;\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    vec2 p = (uv - 0.5) * 2.0;\n    p.x *= iResolution.x / iResolution.y;\n    float r2 = dot(p, p);\n    float k = CA_STRENGTH * r2;\n    vec3 col;\n    col.r = scene(p * (1.0 + k)).r;\n    col.g = scene(p).g;\n    col.b = scene(p * (1.0 - k)).b;\n    vec2 q = uv - 0.5;\n    float vig = 1.0 - VIG_STRENGTH * smoothstep(0.15, 0.75, dot(q, q) * 2.0);\n    col *= vig;\n    fragColor = vec4(pow(col, vec3(1.0 / 2.2)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "chromatic-aberration",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.6041,
      "std": 0.207,
      "unique_colors": 397
     },
     "image": "/specimens/chromatic-aberration-vignette-default.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "lens-flare",
  "film-grain-synthesis"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "film-grain-synthesis",
   "why": "The lens pass runs first and grain is layered on top at the end."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/post/chromatic-aberration.json"
 },
 "solves": [
  "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"
 ],
 "authority": "Unity-Technologies, 2016",
 "url": "https://texelatlas.vercel.app/t/chromatic-aberration/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 2.73,
  "tier": "light",
  "p50_ms": 0.0897,
  "p95_ms": 0.0923,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "chromatic-aberration-vignette-default",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 2.19,
   "tier": "light",
   "p50_ms": 0.0348,
   "p95_ms": 0.0363,
   "speedup_x": 2.58,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 1.87,
   "tier": "feather",
   "p50_ms": 0.0538,
   "p95_ms": 0.0538,
   "speedup_x": 1.67,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}