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

> Edge-preserving smoothing that splits each pixel's neighbourhood into four overlapping sub-windows and outputs the mean of the one with the lowest variance, giving a flat, oil-paint look.

## Reach for it when

- want an oil painting look on a render
- photo should look like a flat poster-style painting
- smooth colour regions but keep edges sharp
- cheap painterly look as a post-process
- reduce detail without blurring edges

## How it works

For every pixel, the square neighbourhood is divided into four quadrants that all share the centre pixel. For each quadrant, compute the mean colour and the variance of brightness. The output is the mean of the quadrant with the smallest variance. Flat regions get averaged strongly, while pixels on a boundary choose the quadrant lying entirely on one side, so edges are not blurred. The larger the radius, the more paint-like the result. Because every pixel computes four windows, cost grows with radius squared, and implementations often use summed-area tables, separable approximations or reduced taps to stay real-time. The blocky look from fixed square windows is the motivation for the anisotropic variant.

## When to use it

Choose it for quick oil-painting or poster-like post-processing of any frame, including 3D renders. Prefer [Anisotropic Kuwahara filter](https://texelatlas.vercel.app/t/anisotropic-kuwahara.md) when blocky square artefacts are visible and you can afford a structure tensor pass. Prefer [Posterization](https://texelatlas.vercel.app/t/posterization.md) for a colour-count reduction without spatial smoothing.

## Cost

medium — Cost scales with window area; a radius of 4 to 8 at 1080p is a medium-cost full-screen pass without optimization.
Measured GPU Weight: 54.23× baseline (heavy) — 1.7843 ms median / 1.9186 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 46.31× baseline (heavy) — 0.7364 ms median (2.42× faster on L4).
Ampere A100 scaling: 36.22× baseline (heavy) — 1.0432 ms median (1.71× faster on A100).

## Failure modes

- Square window produces visible blocky, boxy shapes at larger radii
- Noisy flat regions can flip between quadrants and create speckle
- Can wash out thin lines and small high-contrast details
- Colour banding and temporal shimmer when the winning quadrant switches between frames

## Engine support

- blender: builtin — `Compositor > Add > Creative > Kuwahara` (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, python

## Presets

### Classic Kuwahara, radius 5, procedural image (glsl-fragment; rendered 2026-11-29)

```json
{
  "radius": 5
}
```

```glsl
// GLSL ES 3.0, Shadertoy-style: classic 4-quadrant Kuwahara on a procedural image
const int   R = 5;        // quadrant radius in pixels
const float SPLIT = 0.5;  // left half shows the filtered result, right half the source (set 0.0 for all filtered)

vec3 img(vec2 p){
  vec2 q = p / iResolution.y;
  float n = sin(q.x*17.0)*sin(q.y*13.0) + 0.5*sin(q.x*41.0 + q.y*29.0);
  float d = length(q - vec2(0.9, 0.5));
  vec3 c = 0.5 + 0.5*cos(6.2831*(vec3(0.0,0.33,0.67) + n*0.25 + d*1.4));
  c += 0.18*sin(q.x*400.0)*sin(q.y*380.0);          // high-frequency grain to be removed
  return c;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord){
  if(fragCoord.x / iResolution.x > SPLIT){ fragColor = vec4(clamp(img(fragCoord),0.0,1.0),1.0); return; }
  vec3 bestMean = vec3(0.0);
  float bestVar = 1e9;
  for(int k=0;k<4;k++){
    vec2 s = vec2((k & 1) == 0 ? 1.0 : -1.0, (k & 2) == 0 ? 1.0 : -1.0);
    vec3 sum = vec3(0.0); float sum2 = 0.0;
    for(int j=0;j<=R;j++){
      for(int i=0;i<=R;i++){
        vec3 c = img(fragCoord + vec2(float(i), float(j))*s);
        sum += c;
        float l = dot(c, vec3(0.299,0.587,0.114));
        sum2 += l*l;
      }
    }
    float N = float((R+1)*(R+1));
    vec3 m = sum / N;
    float ml = dot(m, vec3(0.299,0.587,0.114));
    float v = sum2/N - ml*ml;
    if(v < bestVar){ bestVar = v; bestMean = m; }
  }
  fragColor = vec4(clamp(bestMean, 0.0, 1.0), 1.0);
}

```

Attribution: written for this index

## Lineage

- extended by [Anisotropic Kuwahara filter](https://texelatlas.vercel.app/t/anisotropic-kuwahara.md)

## Combines with

- [Anisotropic Kuwahara filter](https://texelatlas.vercel.app/t/anisotropic-kuwahara.md): Classic filter is the baseline; the anisotropic one replaces its square windows.
- [Depth/normal Sobel edge outlines](https://texelatlas.vercel.app/t/screen-space-edge-outline.md): Painterly colour from Kuwahara plus crisp edge lines from G-buffer 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. [implementation] GarrettGunnell (2022) GarrettGunnell/Post-Processing. https://github.com/GarrettGunnell/Post-Processing License: MIT. (verified via github on 2026-11-29)
3. [implementation] noxtgm (2023) noxtgm/kuwahara-filter. https://github.com/noxtgm/kuwahara-filter License: CC0-1.0. (verified via github on 2026-11-29)

## Cite this entry

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