---
id: "anisotropic-kuwahara"
title: "Anisotropic Kuwahara filter"
domain: "npr"
stage: "post"
realtime: "realtime"
platforms: [webgl2, webgpu, desktop-gpu, mobile-gpu, unity, unreal, godot]
year_introduced: 2009
inputs: [ldr-image]
outputs: [ldr-image]
style: "stylized"
dynamic: "both"
cost: "heavy"
authority: "Kyprianidis et al., 2009"
url: "https://texelatlas.vercel.app/t/anisotropic-kuwahara/"
sources_verified_at: "2026-11-29"
---
# Anisotropic Kuwahara filter (Kyprianidis et al., 2009)

> Kuwahara filtering with elliptical, direction-aligned sectors driven by a structure tensor, producing smooth painterly strokes that follow image features instead of axis-aligned blocks.

## Reach for it when

- want an oil painting look from a rendered frame
- blocky artifacts in painterly image filter
- stylize a scene so strokes follow edges and shapes
- photo abstraction that keeps edges crisp but smooths regions

## How it works

First, a structure tensor is estimated per pixel from Sobel gradients and smoothed with a Gaussian. Its eigenvectors give the local feature orientation and its eigenvalues give anisotropy. Each pixel then samples an ellipse oriented along that direction, divided into eight sectors weighted by a smooth polynomial or Gaussian rather than a hard window. For each sector it computes a weighted mean and variance, and blends the sector means with weights that favour low-variance sectors, instead of a hard winner-take-all choice. The soft weighting removes the discontinuities of the classic filter, and the oriented ellipses make edges follow brush-like curves. A multi-scale extension further preserves large-scale structure.

## When to use it

Choose it when you want convincing oil-paint or watercolour-like abstraction from a rendered frame and can budget two or three passes. Prefer [Kuwahara filter](https://texelatlas.vercel.app/t/kuwahara-filter.md) for the cheapest option. Prefer [Painterly rendering with curved brush strokes](https://texelatlas.vercel.app/t/painterly-curved-brush-strokes.md) when you need visible individual brush strokes with direction and texture rather than a smooth filter.

## Cost

heavy — Structure tensor passes plus a heavy sector-sampling pass; medium to heavy depending on radius.
Measured GPU Weight: 171.01× baseline (extreme) — 5.6263 ms median / 5.7956 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 113.45× baseline (extreme) — 1.8038 ms median (3.12× faster on L4).
Ampere A100 scaling: 56.08× baseline (heavy) — 1.6151 ms median (3.48× faster on A100).

## Failure modes

- Flickers on animated scenes because the structure tensor changes frame to frame
- Over-smoothing removes small details and faces unless strength is limited
- Orientation is unstable in flat regions, causing swirls
- Expensive at large radius without separable approximation or mip-based tricks

## Engine support

- blender: builtin — `Compositor > Add > Creative > Kuwahara > Variation = Anisotropic` (evidence: https://docs.blender.org/manual/en/5.2/compositing/types/creative/kuwahara.html, checked 2026-12-01)

## Dataflow

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

## Presets

### Left: noisy source. Right: anisotropic Kuwahara, 8 elliptical sectors oriented by the structure tensor (glsl-fragment; rendered 2026-11-29)

```json
{
  "RAD": 10,
  "QEXP": 4,
  "ALPHA": 1
}
```

```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 img(vec2 p){
  vec3 c=mix(vec3(.12,.18,.34),vec3(.95,.72,.45),clamp(p.y+.5,0.,1.));
  vec2 q=p-vec2(-.03,.14); float rr=.16; float d=length(q)-rr;
  vec3 n=normalize(vec3(q/rr,sqrt(max(1.-dot(q,q)/(rr*rr),0.))));
  float l=clamp(dot(n,normalize(vec3(-.5,.6,.6))),0.,1.);
  c=mix(c,vec3(.85,.26,.2)*(.18+.9*l),smoothstep(.002,-.002,d));
  vec2 r=p-vec2(0.,-.2);
  if(abs(r.x)<.2&&abs(r.y)<.09) c=mix(vec3(.1,.35,.3),vec3(.93,.92,.85),smoothstep(-.3,.3,sin(r.x*340.+r.y*90.)));
  if(p.y<-.34&&p.y>-.42){ vec3 h=.5+.5*cos(6.2832*((p.x+.25)*2.+vec3(0.,.33,.67))); c=h; }
  c=mix(c,vec3(.97,.85,.2),smoothstep(.003,-.003,abs(p.x-.17)-.025)*step(.0,p.y)*step(p.y,.4));
  return c;
}

const float RAD=10.0; // P
const float QEXP=4.0; // P
const float ALPHA=1.0; // P
vec3 src(vec2 p){return img(p)+(hash(floor(p*512.))-.5)*.16;}
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;
  if(!R) col=src(q);
  else{
    float px=1./512.,E=0.,F=0.,G=0.;
    for(int j=-1;j<=1;j++)for(int i=-1;i<=1;i++){vec2 o=q+vec2(float(i),float(j))*4.*px;
      float gx=lum(img(o+vec2(2.*px,0.)))-lum(img(o-vec2(2.*px,0.))),gy=lum(img(o+vec2(0.,2.*px)))-lum(img(o-vec2(0.,2.*px)));
      E+=gx*gx;F+=gx*gy;G+=gy*gy;}
    float th=.5*atan(2.*F,E-G),r=sqrt((E-G)*(E-G)+4.*F*F),A=r/(E+G+1e-6);
    vec2 g=vec2(cos(th),sin(th)),f=vec2(-g.y,g.x);
    float a=RAD*(ALPHA+A)/ALPHA,b=RAD*ALPHA/(ALPHA+A);
    vec3 m[8],s[8];float w[8];
    for(int k=0;k<8;k++){m[k]=vec3(0.);s[k]=vec3(0.);w[k]=0.;}
    for(int j=-4;j<=4;j++)for(int i=-4;i<=4;i++){
      vec2 u=vec2(float(i),float(j))/4.;float l2=dot(u,u);if(l2>1.)continue;
      vec3 c=src(q+(u.x*a*f+u.y*b*g)*px);float wt=exp(-2.5*l2);
      int k=int(clamp(floor((atan(u.y,u.x)/6.2831853+.5)*8.),0.,7.));
      m[k]+=c*wt;s[k]+=c*c*wt;w[k]+=wt;}
    vec3 acc=vec3(0.);float ws=0.;
    for(int k=0;k<8;k++){if(w[k]<1e-4)continue;vec3 mu=m[k]/w[k];vec3 v=max(s[k]/w[k]-mu*mu,0.);
      float wk=1./(1.+pow(20.*sqrt(v.x+v.y+v.z),QEXP));acc+=mu*wk;ws+=wk;}
    col=acc/ws;
  }
  if(abs(uv.x)<.0015)col=vec3(1.);fragColor=vec4(clamp(col,0.,1.),1.);
}
```

Attribution: written for this index

## Lineage

- extends [Kuwahara filter](https://texelatlas.vercel.app/t/kuwahara-filter.md)

## Combines with

- [Depth/normal Sobel edge outlines](https://texelatlas.vercel.app/t/screen-space-edge-outline.md): Painterly colour regions from the filter, lines from depth/normal edges.

## Sources

1. [primary] Jan Eric Kyprianidis, Henry Kang, Jürgen Döllner (2009) Image and Video Abstraction by Anisotropic Kuwahara Filtering. Computer Graphics Forum. https://doi.org/10.1111/j.1467-8659.2009.01574.x (verified via crossref on 2026-11-29)
2. [primary] Jan Eric Kyprianidis (2011) Image and video abstraction by multi-scale anisotropic Kuwahara filtering. Proceedings of the ACM SIGGRAPH/Eurographics Symposium on Non-Photorealistic Animation and Rendering. https://doi.org/10.1145/2024676.2024686 (verified via crossref on 2026-11-29)
3. [implementation] GarrettGunnell (2022) GarrettGunnell/Post-Processing. https://github.com/GarrettGunnell/Post-Processing License: MIT. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Anisotropic Kuwahara filter." https://texelatlas.vercel.app/t/anisotropic-kuwahara/ (accessed 2026-12-01).
