---
id: "fxaa"
title: "FXAA"
aliases: [Fast Approximate Anti-Aliasing]
domain: "post"
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"
cost: "cheap"
authority: "Lottes"
url: "https://texelatlas.vercel.app/t/fxaa/"
sources_verified_at: "2026-11-29"
---
# FXAA (Lottes)

> 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.

## Reach for it when

- 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

## 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 it

Choose it when you need the cheapest possible AA on mobile or WebGL, or as a fallback for forward-rendered scenes without motion vectors.

Prefer [SMAA](https://texelatlas.vercel.app/t/smaa.md) when you can afford three passes and want sharper results with proper corner handling. Prefer [Temporal Anti-Aliasing](https://texelatlas.vercel.app/t/temporal-anti-aliasing.md) when shading aliasing and subpixel detail dominate and motion vectors exist.

## Cost

cheap — Single full-screen pass with a handful of texture fetches; the cheapest AA in this index (qualitative).
Measured GPU Weight: 11.42× baseline (moderate) — 0.3758 ms median / 0.3902 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 8.51× baseline (moderate) — 0.1353 ms median (2.78× faster on L4).
Ampere A100 scaling: 7.82× baseline (moderate) — 0.2253 ms median (1.67× faster on A100).

## 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

## Engine support

- babylonjs: builtin — `pipeline.fxaaEnabled = true (DefaultRenderingPipeline) or new BABYLON.FxaaPostProcess` (evidence: https://github.com/BabylonJS/Babylon.js/blob/9.38.0/packages/dev/core/src/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.ts, checked 2026-12-01)
- godot: builtin — `Viewport.screen_space_aa = Viewport.SCREEN_SPACE_AA_FXAA` (evidence: https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Viewport.xml, checked 2026-12-01)
- threejs: official — `import { fxaa } from 'three/addons/tsl/display/FXAANode.js' (WebGL: FXAAPass)` (evidence: https://github.com/mrdoob/three.js/blob/r187/examples/jsm/tsl/display/FXAANode.js, checked 2026-12-01)
- unity: builtin — `URP: Camera > Rendering > Anti-aliasing = Fast Approximate Anti-aliasing (FXAA)` (evidence: https://github.com/Unity-Technologies/Graphics/blob/557f6ac22b948284f57ffae6a789751fd1f63620/Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/FXAA3_11.hlsl, checked 2026-12-01) — URP and HDRP.
- unreal: builtin — `Project Settings > Rendering > Default Settings > Anti-Aliasing Method = FXAA` (evidence: https://dev.epicgames.com/documentation/en-us/unreal-engine/anti-aliasing-and-upscaling-in-unreal-engine, checked 2026-12-01)

## Dataflow

- Inputs: ldr-image
- Outputs: ldr-image
- Platforms: webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal

## Presets

### Left: aliased frame. Right: FXAA, luma-gradient direction and two blurred taps along the edge (glsl-fragment; rendered 2026-11-29)

```json
{
  "DREDMUL": 0.125,
  "DREDMIN": 0.0078
}
```

```glsl
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.);}
float lum(vec3 c){return dot(c,vec3(.2126,.7152,.0722));}
vec3 gam(vec3 c){return pow(clamp(c,0.,1.),vec3(1./2.2));}
vec3 scnA(vec2 px){vec2 p=(px-256.)/512.;
  vec3 c=vec3(.93,.92,.88);
  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));
  float d=length(p-vec2(.0,.0));c=mix(c,vec3(.85,.25,.2),step(abs(d-.2),.02));
  c=mix(c,vec3(.1,.5,.4),step(length(p-vec2(-.25,.28)),.1));
  c=mix(c,vec3(.1),step(abs(p.x-.2),.004)*step(abs(p.y-.1),.3));
  return c;}

const float DREDMUL=0.125; // P
const float DREDMIN=0.0078; // P
vec3 T(vec2 f){return scnA(floor(f)+.5);}
vec3 Tb(vec2 f){vec2 g=f-.5,i=floor(g),w=g-i;
  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);}
void mainImage(out vec4 fragColor,in vec2 fragCoord){
  vec2 uv=(fragCoord-.5*iResolution.xy)/iResolution.y;bool R=uv.x>0.;vec2 q=vec2(uv.x+(R?-.25:.25),uv.y);
  vec3 col=T(fragCoord);
  if(R){
    vec2 f=floor(fragCoord)+.5;
    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);
    float a=lum(nw),b=lum(ne),c=lum(sw),d=lum(se),e=lum(m);
    float lo=min(e,min(min(a,b),min(c,d))),hi=max(e,max(max(a,b),max(c,d)));
    vec2 dir=vec2(-((a+b)-(c+d)),(a+c)-(b+d));
    float red=max((a+b+c+d)*.25*DREDMUL,DREDMIN);
    dir=clamp(dir/(min(abs(dir.x),abs(dir.y))+red),-8.,8.);
    vec3 r1=.5*(Tb(f+dir*(1./3.-.5))+Tb(f+dir*(2./3.-.5)));
    vec3 r2=r1*.5+.25*(Tb(f-dir*.5)+Tb(f+dir*.5));
    float lb=lum(r2);col=(lb<lo||lb>hi)?r1:r2;
  }
  if(abs(uv.x)<.0015)col=vec3(1.);fragColor=vec4(clamp(col,0.,1.),1.);
}
```

Attribution: written for this index

## Lineage

- extended by [SMAA](https://texelatlas.vercel.app/t/smaa.md)

## Combines with

- [Temporal Anti-Aliasing](https://texelatlas.vercel.app/t/temporal-anti-aliasing.md): FXAA can clean up the output of a TAA resolve on frames where history was rejected.

## Sources

1. [primary] Timothy Lottes FXAA. NVIDIA white paper. https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf (verified via http on 2026-11-29)

## Cite this entry

Texel. "FXAA." https://texelatlas.vercel.app/t/fxaa/ (accessed 2026-12-01).
