---
id: "svgf"
title: "Spatiotemporal Variance-Guided Filtering (SVGF)"
aliases: [SVGF, A-SVGF]
domain: "post"
stage: "post"
realtime: "realtime"
platforms: [desktop-gpu, webgpu, unity, unreal]
year_introduced: 2017
inputs: [radiance, gbuffer, normals, depth]
outputs: [radiance]
style: "photoreal"
dynamic: "dynamic"
cost: "medium"
authority: "Schied et al., 2017"
url: "https://texelatlas.vercel.app/t/svgf/"
sources_verified_at: "2026-11-29"
---
# Spatiotemporal Variance-Guided Filtering (SVGF) (Schied et al., 2017)

> A real-time denoiser for 1-sample-per-pixel path-traced lighting: it reprojects history, estimates per-pixel variance, and drives an edge-aware wavelet blur whose strength follows that variance.

## Reach for it when

- path traced one sample per pixel image is very noisy
- denoise ray traced global illumination in real time
- noisy indirect lighting flickers between frames
- need a temporal denoiser that keeps texture detail
- ray traced shadows look grainy at low sample counts

## How it works

Input is noisy irradiance (demodulated from albedo) at roughly one path per pixel plus a G-buffer with normals, depth and motion vectors. Stage one reprojects the previous frame's accumulated colour and its first two luminance moments, rejecting history at disocclusions or when normals and depth differ, and blends it exponentially. The moments give a temporal variance estimate; where history is too young (just revealed pixels) a small spatial neighbourhood supplies the variance instead. Stage two runs several iterations of an edge-avoiding à-trous wavelet filter (see [Edge-avoiding a-trous wavelet filter](https://texelatlas.vercel.app/t/atrous-wavelet-filter.md)), with steps 1, 2, 4, 8, 16. Edge-stopping weights combine depth gradient, normal similarity and a luminance term normalised by the smoothed local standard deviation, so noisy regions blur broadly while clean ones keep detail. The first iteration's output is fed back as next frame's history. The filtered irradiance is finally multiplied by albedo again, preserving texture detail.

## When to use it

Choose it as the default open, well-documented denoiser for diffuse and rough-glossy path-traced or ray-traced GI and shadows at one sample per pixel. Prefer [NVIDIA Real-time Denoisers (ReBLUR, ReLAX)](https://texelatlas.vercel.app/t/nvidia-nrd-relax-reblur.md) when you want a maintained production library that separates diffuse, specular and shadow signals, [Intel Open Image Denoise (OIDN)](https://texelatlas.vercel.app/t/open-image-denoise.md) for offline or interactive final-quality output, and [Neural Radiance Caching](https://texelatlas.vercel.app/t/neural-radiance-caching.md) or [ReSTIR GI: Path Resampling for Real-Time Path Tracing](https://texelatlas.vercel.app/t/restir-gi.md) to reduce the noise at the source before filtering.

## Cost

medium — Five wavelet passes plus a temporal pass at full resolution; the original paper reports about 10 ms at 720p on a Titan X-class GPU in its own test scenes, so budget scales with resolution.
Measured GPU Weight: 45.88× baseline (heavy) — 1.5093 ms median / 1.6104 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 43.57× baseline (heavy) — 0.6927 ms median (2.18× faster on L4).
Ampere A100 scaling: 30.56× baseline (heavy) — 0.8801 ms median (1.71× faster on A100).

## Failure modes

- Ghosting and lag in lighting after fast-moving lights or objects because history rejection is only geometric
- Over-blurred sharp specular reflections and mirror-like surfaces, since the filter assumes diffuse-like signals
- Blotchy low-frequency 'boiling' where variance estimates are noisy after disocclusion
- Loss of fine shadow or contact detail at the largest wavelet steps
- Needs accurately demodulated albedo and a clean motion-vector buffer; errors become smear

## Dataflow

- Inputs: radiance, gbuffer, normals, depth
- Outputs: radiance
- Platforms: desktop-gpu, webgpu, unity, unreal

## Presets

### SVGF — raw 1-spp path-traced variance (left) vs albedo-demodulated variance-guided a-trous wavelet filter (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_VARIANCE": 0.8,
  "P_ATROUS_STR": 1,
  "P_EDGE_STOP": 0.85,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_VARIANCE = 0.80; // P 1-spp Variance [0.2, 1.5, 0.05]
const float P_ATROUS_STR = 1.00; // P Wavelet Stride [0.4, 1.8, 0.05]
const float P_EDGE_STOP = 0.85; // P Normal/Depth Stop [0.2, 1.5, 0.05]
const float P_SPLIT = 0.48; // P 1-spp / SVGF [0.0, 1.0, 0.02]

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.5);
  return fract(p.x * p.y);
}

// Architectural room with crisp albedo stripes & shadow boundaries for SVGF demodulation + a-trous wavelet test
void evalSVGFScene(vec2 uv, float t, out vec3 irr, out vec3 alb, out vec3 nrm, out float dep) {
  vec3 ro = vec3(0.0, 0.30, 2.25);
  vec3 rd = normalize(vec3(uv.x, uv.y - 0.08, -1.46));
  vec3 sun = normalize(vec3(0.62 * cos(t * 0.45), 0.75, 0.45));

  dep = 10.0;
  alb = vec3(0.18, 0.22, 0.28);
  nrm = vec3(0.0, 0.0, 1.0);
  irr = vec3(0.28, 0.38, 0.55);

  // Checker floor
  if (rd.y < -0.005) {
    float tf = (-0.52 - ro.y) / rd.y;
    if (tf > 0.05 && tf < dep) {
      dep = tf;
      vec3 hp = ro + rd * tf;
      nrm = vec3(0.0, 1.0, 0.0);
      float chk = mod(floor(hp.x * 4.0) + floor(hp.z * 4.0), 2.0);
      alb = mix(vec3(0.26, 0.30, 0.36), vec3(0.82, 0.80, 0.76), chk);
      float sh = smoothstep(0.25, 0.56, length(hp.xz - vec2(0.0, -0.05)));
      irr = vec3(1.35, 1.24, 1.08) * (0.18 + 0.82 * sh) + vec3(0.18, 0.32, 0.52) * 0.45;
    }
  }

  // Faceted plinth box + sphere
  vec3 sc = vec3(0.0, -0.10, -0.05);
  vec3 oc = ro - sc;
  float b = dot(oc, rd), d = b * b - (dot(oc, oc) - 0.42 * 0.42);
  if (d > 0.0) {
    float ts = -b - sqrt(d);
    if (ts > 0.05 && ts < dep) {
      dep = ts;
      vec3 hp = ro + rd * ts;
      nrm = normalize(hp - sc);
      float band = step(0.5, fract(hp.y * 12.0 + hp.x * 4.0));
      alb = mix(vec3(0.88, 0.42, 0.20), vec3(0.92, 0.86, 0.72), band);
      float ndl = max(dot(nrm, sun), 0.0);
      irr = vec3(1.42, 1.28, 1.08) * ndl + vec3(0.22, 0.42, 0.68) * (0.5 + 0.5 * nrm.y) + vec3(0.40, 0.24, 0.16) * max(-nrm.y, 0.0);
    }
  }

  // Side accent monolith
  vec3 bc = vec3(-0.75, -0.04, -0.45);
  vec3 br = vec3(0.22, 0.48, 0.24);
  vec3 invR = 1.0 / (rd + vec3(1e-6));
  vec3 t0 = (bc - br - ro) * invR;
  vec3 t1 = (bc + br - ro) * invR;
  vec3 tnV = min(t0, t1);
  vec3 tfV = max(t0, t1);
  float tn = max(max(tnV.x, tnV.y), tnV.z);
  float tf = min(min(tfV.x, tfV.y), tfV.z);
  if (tf > max(tn, 0.05) && tn < dep) {
    dep = tn;
    vec3 hp = ro + rd * tn;
    vec3 lp = (hp - bc) / br;
    vec3 ap = abs(lp);
    nrm = (ap.x > ap.y && ap.x > ap.z) ? vec3(sign(lp.x), 0.0, 0.0)
        : (ap.y > ap.z ? vec3(0.0, sign(lp.y), 0.0) : vec3(0.0, 0.0, sign(lp.z)));
    alb = vec3(0.18, 0.72, 0.82);
    irr = vec3(1.35, 1.24, 1.08) * max(dot(nrm, sun), 0.0) + vec3(0.24, 0.34, 0.48);
  }
}

vec3 noisyDemodIrr(vec2 fc, float varAmp, float t, out vec3 alb, out vec3 nrm, out float dep) {
  vec2 uv = (fc - 0.5 * iResolution.xy) / iResolution.y;
  vec3 irr;
  evalSVGFScene(uv, t, irr, alb, nrm, dep);
  vec2 p = floor(fc);
  float fr = floor(t * 12.0) * 0.17;
  vec3 rnd = vec3(
    hash21(p + vec2(fr * 23.1, 9.7)),
    hash21(p + vec2(51.3, fr * 17.3)),
    hash21(p + vec2(fr * 71.7, 37.9))
  ) - 0.5;
  return max(irr + rnd * varAmp * (0.5 + 0.75 * irr), 0.0);
}

float luma(vec3 c) {
  return dot(c, vec3(0.299, 0.587, 0.114));
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  float screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  float varAmp = clamp(P_VARIANCE, 0.1, 1.6);
  float stride = clamp(P_ATROUS_STR, 0.4, 2.2);
  float edgeStop = clamp(P_EDGE_STOP, 0.1, 1.8);

  vec3 cAlb, cNrm;
  float cDep;
  vec3 cIrr = noisyDemodIrr(fragCoord, varAmp, iTime, cAlb, cNrm, cDep);
  vec3 col = cIrr * cAlb;

  if (screenX >= split) {
    // Right: SVGF variance-guided edge-stopping a-trous wavelet filter on demodulated irradiance!
    // Step 1: Estimate local luminance moments (mu1, mu2 -> variance) in 3x3 neighborhood
    float m1 = 0.0;
    float m2 = 0.0;
    for (int j = -1; j <= 1; j++) {
      for (int i = -1; i <= 1; i++) {
        vec3 qa, qn; float qd;
        float yl = luma(noisyDemodIrr(fragCoord + vec2(float(i), float(j)), varAmp, iTime, qa, qn, qd));
        m1 += yl;
        m2 += yl * yl;
      }
    }
    m1 /= 9.0;
    m2 /= 9.0;
    float localVar = max(m2 - m1 * m1, 0.002);
    float phiL = 4.0 * sqrt(localVar) + 0.05;

    // Step 2: 5x5 a-trous wavelet pass with B3-spline kernel [1/16, 1/4, 3/8, 1/4, 1/16]
    float kW[5];
    kW[0] = 0.0625; kW[1] = 0.25; kW[2] = 0.375; kW[3] = 0.25; kW[4] = 0.0625;
    float cLuma = luma(cIrr);
    vec3 acc = vec3(0.0);
    float wSum = 0.0;

    for (int j = -2; j <= 2; j++) {
      for (int i = -2; i <= 2; i++) {
        vec2 off = vec2(float(i), float(j)) * (2.0 * stride);
        vec3 qAlb, qNrm;
        float qDep;
        vec3 qIrr = noisyDemodIrr(fragCoord + off, varAmp, iTime, qAlb, qNrm, qDep);
        float wKern = kW[i + 2] * kW[j + 2];
        float wN = pow(max(dot(cNrm, qNrm), 0.0), 28.0 * edgeStop);
        float wZ = exp(-abs(cDep - qDep) * 5.0 * edgeStop);
        float wL = exp(-abs(cLuma - luma(qIrr)) / max(phiL, 0.02));
        float w = wKern * wN * wZ * wL;
        acc += qIrr * w;
        wSum += w;
      }
    }
    // Re-modulate filtered irradiance by noise-free G-buffer albedo
    col = (acc / max(wSum, 1e-4)) * cAlb;
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.98, 1.0), sep);
  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: MIT — written for this index.

## Lineage

- extends [Edge-avoiding a-trous wavelet filter](https://texelatlas.vercel.app/t/atrous-wavelet-filter.md)
- extended by [NVIDIA Real-time Denoisers (ReBLUR, ReLAX)](https://texelatlas.vercel.app/t/nvidia-nrd-relax-reblur.md)

## Combines with

- [ReSTIR DI: Spatiotemporal Reservoir Resampling for Direct Lighting](https://texelatlas.vercel.app/t/restir-di.md): ReSTIR reduces direct-lighting variance upstream; SVGF then cleans the remaining per-pixel noise.
- [Temporal Anti-Aliasing](https://texelatlas.vercel.app/t/temporal-anti-aliasing.md): SVGF's denoised irradiance is remodulated by albedo and then goes through TAA for edge and specular stability.

## Sources

1. [primary] Christoph Schied, Anton Kaplanyan, Chris Wyman, Anjul Patney, Chakravarty R. Alla Chaitanya, John Burgess, Shiqiu Liu, Carsten Dachsbacher, Aaron Lefohn, Marco Salvi (2017) Spatiotemporal variance-guided filtering. Proceedings of High Performance Graphics. https://doi.org/10.1145/3105762.3105770 (verified via crossref on 2026-11-29)
2. [primary] Schied et al. Spatiotemporal Variance-Guided Filtering: Real-Time Reconstruction for Path-Traced Global Illumination. research.nvidia.com. https://research.nvidia.com/publication/2017-07_spatiotemporal-variance-guided-filtering-real-time-reconstruction-path-traced (verified via http on 2026-11-29)
3. [implementation] NVIDIAGameWorks (2017) NVIDIAGameWorks/Falcor. https://github.com/NVIDIAGameWorks/Falcor License: NOASSERTION. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Spatiotemporal Variance-Guided Filtering (SVGF)." https://texelatlas.vercel.app/t/svgf/ (accessed 2026-12-01).
