{
 "id": "fxaa",
 "title": "FXAA",
 "aliases": [
  "Fast Approximate Anti-Aliasing"
 ],
 "domain": "post",
 "subdomain": "anti-aliasing",
 "stage": "post",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "unity",
  "unreal"
 ],
 "year_introduced": 2009,
 "inputs": [
  "ldr-image"
 ],
 "outputs": [
  "ldr-image"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "A single-pass post filter that finds edges from luma contrast, estimates their orientation and blends pixels along the edge normal; cheap and shader-only, but it also softens interior texture detail.",
 "how_it_works": "FXAA runs on the final LDR image with no depth or geometry. It computes luma for a pixel and its four neighbours, skips the pixel if local contrast is below a threshold, then classifies the edge as horizontal or vertical from second-derivative-like sums over the 3x3 neighbourhood. It moves half a pixel toward the stronger gradient side, searches along the edge in both directions until the luma profile departs from the edge average, and uses the endpoints to compute a subpixel offset. The final sample is a bilinear fetch shifted perpendicular to the edge, which blends the edge with the other side. A separate subpixel-aliasing term lowpasses isolated bright pixels. Quality presets differ in the length of the edge search.",
 "when_to_use": "Choose it when you need the cheapest possible AA on mobile or WebGL, or as a fallback for forward-rendered scenes without motion vectors.\n\nPrefer `smaa` when you can afford three passes and want sharper results with proper corner handling. Prefer `temporal-anti-aliasing` when shading aliasing and subpixel detail dominate and motion vectors exist.",
 "cost": {
  "class": "cheap",
  "notes": "Single full-screen pass with a handful of texture fetches; the cheapest AA in this index (qualitative)."
 },
 "failure_modes": [
  "Global softening of text and fine textures because it cannot distinguish edges from detail",
  "Rounded corners and wobbly near-horizontal lines from the heuristic edge search",
  "No help with subpixel geometry or temporal shimmer",
  "Must run after tonemapping, otherwise HDR highlights alias unfiltered"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "url:https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf",
   "type": "web",
   "title": "FXAA",
   "authors": [
    "Timothy Lottes"
   ],
   "year": null,
   "venue": "NVIDIA white paper",
   "url": "https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261116073717/https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf",
     "timestamp": "20261116073717"
    },
    "page_title": null,
    "host": "developer.download.nvidia.com",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "lottesfxaa"
  }
 ],
 "presets": [
  {
   "id": "fxaa-specimen",
   "title": "Left: aliased frame. Right: FXAA, luma-gradient direction and two blurred taps along the edge",
   "runtime": "glsl-fragment",
   "params": {
    "DREDMUL": 0.125,
    "DREDMIN": 0.0078
   },
   "code": "float hash(vec2 c){uvec2 u=uvec2(ivec2(floor(c)));uint h=u.x*1597334673u^u.y*3812015801u;h^=h>>15;h*=2246822519u;h^=h>>13;h*=3266489917u;h^=h>>16;return float(h)*(1./4294967296.);}\nfloat lum(vec3 c){return dot(c,vec3(.2126,.7152,.0722));}\nvec3 gam(vec3 c){return pow(clamp(c,0.,1.),vec3(1./2.2));}\nvec3 scnA(vec2 px){vec2 p=(px-256.)/512.;\n  vec3 c=vec3(.93,.92,.88);\n  float s=fract((p.x*.866+p.y*.5)*11.);c=mix(c,vec3(.1,.12,.2),step(s,.18)*step(abs(p.y+p.x*.3),.38));\n  float d=length(p-vec2(.0,.0));c=mix(c,vec3(.85,.25,.2),step(abs(d-.2),.02));\n  c=mix(c,vec3(.1,.5,.4),step(length(p-vec2(-.25,.28)),.1));\n  c=mix(c,vec3(.1),step(abs(p.x-.2),.004)*step(abs(p.y-.1),.3));\n  return c;}\n\nconst float DREDMUL=0.125; // P\nconst float DREDMIN=0.0078; // P\nvec3 T(vec2 f){return scnA(floor(f)+.5);}\nvec3 Tb(vec2 f){vec2 g=f-.5,i=floor(g),w=g-i;\n  return mix(mix(T(i+.5),T(i+vec2(1.5,.5)),w.x),mix(T(i+vec2(.5,1.5)),T(i+1.5),w.x),w.y);}\nvoid mainImage(out vec4 fragColor,in vec2 fragCoord){\n  vec2 uv=(fragCoord-.5*iResolution.xy)/iResolution.y;bool R=uv.x>0.;vec2 q=vec2(uv.x+(R?-.25:.25),uv.y);\n  vec3 col=T(fragCoord);\n  if(R){\n    vec2 f=floor(fragCoord)+.5;\n    vec3 nw=T(f+vec2(-1.,-1.)),ne=T(f+vec2(1.,-1.)),sw=T(f+vec2(-1.,1.)),se=T(f+vec2(1.,1.)),m=T(f);\n    float a=lum(nw),b=lum(ne),c=lum(sw),d=lum(se),e=lum(m);\n    float lo=min(e,min(min(a,b),min(c,d))),hi=max(e,max(max(a,b),max(c,d)));\n    vec2 dir=vec2(-((a+b)-(c+d)),(a+c)-(b+d));\n    float red=max((a+b+c+d)*.25*DREDMUL,DREDMIN);\n    dir=clamp(dir/(min(abs(dir.x),abs(dir.y))+red),-8.,8.);\n    vec3 r1=.5*(Tb(f+dir*(1./3.-.5))+Tb(f+dir*(2./3.-.5)));\n    vec3 r2=r1*.5+.25*(Tb(f-dir*.5)+Tb(f+dir*.5));\n    float lb=lum(r2);col=(lb<lo||lb>hi)?r1:r2;\n  }\n  if(abs(uv.x)<.0015)col=vec3(1.);fragColor=vec4(clamp(col,0.,1.),1.);\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": "fxaa",
     "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.7795,
      "std": 0.2802,
      "unique_colors": 44
     },
     "image": "/specimens/fxaa-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "smaa",
  "temporal-anti-aliasing"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "temporal-anti-aliasing",
   "why": "FXAA can clean up the output of a TAA resolve on frames where history was rejected."
  }
 ],
 "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/fxaa.json"
 },
 "solves": [
  "jagged edges but no budget for heavy antialiasing",
  "mobile or webgl needs the cheapest edge smoothing",
  "msaa isn't available in my deferred pipeline",
  "need quick post-process edge softening"
 ],
 "authority": "Lottes",
 "url": "https://texelatlas.vercel.app/t/fxaa/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 11.42,
  "tier": "moderate",
  "p50_ms": 0.3758,
  "p95_ms": 0.3902,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "fxaa-specimen",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 8.51,
   "tier": "moderate",
   "p50_ms": 0.1353,
   "p95_ms": 0.1372,
   "speedup_x": 2.78,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 7.82,
   "tier": "moderate",
   "p50_ms": 0.2253,
   "p95_ms": 0.2259,
   "speedup_x": 1.67,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}