---
id: "path-guiding"
title: "Practical Path Guiding"
aliases: [guided path tracing, SD-tree guiding]
domain: "gi"
stage: "lighting"
realtime: "offline"
platforms: [cpu, cuda]
year_introduced: 2017
inputs: [mesh, material-params]
outputs: [radiance]
style: "photoreal"
dynamic: "static"
cost: "offline"
authority: "Müller et al., 2017"
url: "https://texelatlas.vercel.app/t/path-guiding/"
sources_verified_at: "2026-11-29"
---
# Practical Path Guiding (Müller et al., 2017)

> Learns a spatially varying directional distribution of incident radiance during rendering, then uses it to sample bounce directions, cutting noise in scenes with hard indirect light.

## Reach for it when

- indirect light through narrow openings stays noisy
- path tracer wastes samples in the wrong directions
- lamp shades and layered materials render grainy
- need smarter bounce directions learned while rendering
- caustic-like paths converge too slowly

## How it works

Standard BSDF sampling ignores where the light actually comes from. Path guiding builds an approximation of the incident radiance field `L(x, w)` and samples new directions from a distribution proportional to it times the BSDF cosine, ideally minimizing variance.

The practical version stores that field in a **spatial binary tree** whose leaves each hold a **directional quadtree** on an equal-area sphere mapping. Every path vertex contributes (via its estimated radiance, weighted by throughput) to the leaf containing it. Trees refine: spatial nodes split when they accumulate enough samples, directional nodes split when they hold too much energy.

Rendering proceeds in **iterations** of doubling sample counts. Iteration `k` samples from the distribution learned in iteration `k-1`, and its own samples train the next one, with earlier iterations' results combined by inverse variance for the final image. The learned distribution is combined with BSDF sampling by one-sample MIS, which protects against bad guides and keeps the estimator unbiased.

## When to use it

Choose it for offline scenes where indirect light arrives through narrow openings, lamp shades or complex layered materials and standard path tracing remains noisy.

Prefer [path-tracing](path-tracing) with [multiple-importance-sampling](multiple-importance-sampling) for simple scenes, since learning costs memory and time. Prefer [metropolis-light-transport](metropolis-light-transport) for the most constrained paths where adaptive proposals still fail. Prefer [neural-radiance-caching](neural-radiance-caching) for real-time budgets, since guiding still needs many samples per pixel.

## Cost

offline — Tree training adds modest per-sample overhead; the benefit is lower variance per sample and faster convergence on hard scenes.
Measured GPU Weight: 3.3× baseline (light) — 0.1086 ms median / 0.1108 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 2.56× baseline (light) — 0.0407 ms median (2.67× faster on L4).
Ampere A100 scaling: 1.99× baseline (feather) — 0.0572 ms median (1.9× faster on A100).

## Failure modes

- Poor training early on: the first iterations can be worse than unguided sampling
- Spatial subdivision cannot represent thin or high-frequency geometry, so guiding is blurry in complex areas
- Pure diffuse scenes see little or no gain while paying the learning overhead
- Fireflies from a sharply peaked learned distribution if the BSDF fallback fraction is too small

## Engine support

- blender: builtin — `Properties > Render > Sampling > Path Guiding` (evidence: https://docs.blender.org/manual/en/5.2/render/cycles/render_settings/sampling.html, checked 2026-12-01) — CPU only.

## Dataflow

- Inputs: mesh, material-params
- Outputs: radiance
- Platforms: cpu, cuda

## Presets

### Practical Path Guiding — cosine hemisphere noise (left) vs SD-tree directional guiding lobes (right) (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_GUIDE_SHARP": 0.85,
  "P_LOBE_VIS": 0.85,
  "P_LIGHT_ORBIT": 0.65,
  "P_SPLIT": 0.48
}
```

```glsl
const float P_GUIDE_SHARP = 0.85; // P Guiding Focus [0.1, 1.0, 0.02]
const float P_LOBE_VIS = 0.85; // P SD-Tree Lobes [0.0, 1.5, 0.05]
const float P_LIGHT_ORBIT = 0.65; // P Caustic Sweep [0.0, 2.2, 0.05]
const float P_SPLIT = 0.48; // P Unguided / Guided [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);
}

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) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float screenX = fragCoord.x / max(iResolution.x, 1.0);
  float split = clamp(P_SPLIT, 0.0, 1.0);
  bool isGuided = screenX >= split;
  float sharp = clamp(P_GUIDE_SHARP, 0.05, 1.0);
  float lobeVis = clamp(P_LOBE_VIS, 0.0, 1.6);
  float spin = iTime * max(P_LIGHT_ORBIT, 0.0);

  // Perspective glossy-diffuse floor & central reflective torus illuminated by a tiny bright ceiling skylight!
  vec3 ro = vec3(0.0, 0.65, 2.25);
  vec3 rd = normalize(vec3(uv - vec2(0.0, 0.14), -1.42));

  vec3 bg = mix(vec3(0.018, 0.024, 0.042), vec3(0.055, 0.072, 0.118), smoothstep(-0.5, 0.5, uv.y));
  vec3 col = bg;

  // Moving small high-radiance skylight / indirect mirror patch (primary target of directional guiding!)
  vec3 lightPos = vec3(0.75 * cos(spin * 0.55), 1.35, 0.45 * sin(spin * 0.55) - 0.25);

  // Intersect hero sphere (R=0.46 at y=0.04) and floor plane (y=-0.42)
  vec3 sc = vec3(0.0, 0.04, 0.0);
  vec3 oc = ro - sc;
  float b = dot(oc, rd);
  float c = dot(oc, oc) - 0.46 * 0.46;
  float disc = b * b - c;
  float tSph = (disc > 0.0 && (-b - sqrt(disc)) > 0.05) ? (-b - sqrt(disc)) : 1e5;
  float tFl = (rd.y < -0.01) ? ((-0.42 - ro.y) / rd.y) : 1e5;
  if (tFl < 0.05 || tFl > 12.0) tFl = 1e5;

  float tHit = min(tSph, tFl);
  if (tHit < 1e4) {
    vec3 p = ro + rd * tHit;
    vec3 n = (tSph < tFl) ? normalize(p - sc) : vec3(0.0, 1.0, 0.0);
    vec3 toL = lightPos - p;
    float distL = length(toL);
    vec3 lDir = toL / max(distL, 1e-4);

    // Soft sphere shadow on floor
    vec3 toSc = sc - p;
    float proj = dot(toSc, lDir);
    float perp = length(toSc - lDir * max(proj, 0.0));
    float shadow = (tFl < tSph && proj > 0.0) ? smoothstep(0.38, 0.52, perp) : 1.0;

    float diff = max(dot(n, lDir), 0.0) * shadow;
    float spec = pow(max(dot(n, normalize(lDir - rd)), 0.0), 42.0) * shadow;
    // Focused indirect caustic ring around base of sphere
    float caustic = (tFl < tSph) ? exp(-abs(length(p.xz) - 0.64) * 14.0) * (0.4 + 0.6 * max(dot(normalize(p.xz + 1e-4), lDir.xz), 0.0)) : 0.0;

    vec3 alb = (tSph < tFl) ? vec3(0.84, 0.68, 0.46) : vec3(0.38, 0.42, 0.48);
    vec3 cleanCol = alb * (0.14 + 1.35 * diff / (0.65 + 0.35 * distL))
                  + vec3(1.0, 0.94, 0.82) * (spec * 0.95 + caustic * 0.72);

    if (isGuided) {
      // Right: Learned SD-Tree directional guiding concentrates rays into the skylight lobe -> low variance!
      float residNoise = (hash21(floor(fragCoord) + floor(iTime * 12.0) * 0.13) - 0.5) * 0.16 * (1.0 - sharp);
      col = cleanCol * (1.0 + residNoise);

      // Overlay subtle spatial SD-Tree quad cells & directional guiding arrows pointing toward lightPos on floor!
      if (tFl < tSph && lobeVis > 0.02) {
        vec2 cellUV = p.xz * 2.2;
        vec2 cellF = fract(cellUV) - 0.5;
        vec2 cellD = 0.5 - abs(cellF);
        float sdGrid = smoothstep(0.028, 0.008, min(cellD.x, cellD.y));
        // Directional Von Mises-Fisher / quadtree lobe petal aligned toward lDir.xz
        vec2 dir2 = normalize(lDir.xz + vec2(1e-4));
        float rC = length(cellF);
        float align = max(dot(normalize(cellF + vec2(1e-5)), dir2), 0.0);
        float lobeR = 0.08 + 0.24 * pow(align, mix(1.5, 6.0, sharp));
        float lobeRing = exp(-abs(rC - lobeR) * 58.0) * smoothstep(0.45, 0.05, rC);
        col += vec3(0.16, 0.82, 0.98) * (sdGrid * 0.18 + lobeRing * 0.55) * lobeVis;
      }
    } else {
      // Left: Unguided cosine-weighted sampling misses small light & caustic -> heavy variance & fireflies!
      vec2 pix = floor(fragCoord * 0.75);
      float fr = floor(iTime * 10.0) * 0.17;
      float r1 = hash21(pix + vec2(fr * 13.7, 2.9));
      float r2 = hash21(pix * 1.27 + vec2(9.1, fr * 23.3));
      float variance = mix(0.22, 1.85, r1);
      float firefly = smoothstep(0.95, 0.998, r2) * 5.8 * (0.25 + spec + caustic);
      col = cleanCol * variance + vec3(1.0, 0.90, 0.72) * firefly;
    }

    if (tFl < tSph) col = mix(col, bg, 1.0 - exp(-tFl * 0.12));
  }

  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
  col = mix(col, vec3(0.95, 0.97, 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.

## Combines with

- [Multiple Importance Sampling](https://texelatlas.vercel.app/t/multiple-importance-sampling.md): One-sample MIS between the learned guide and BSDF sampling keeps the combined estimator robust and unbiased.

## Sources

1. [primary] Thomas Müller, Markus Gross, Jan Novák (2017) Practical Path Guiding for Efficient Light‐Transport Simulation. Computer Graphics Forum. https://doi.org/10.1111/cgf.13227 (verified via crossref on 2026-11-29)

## Cite this entry

Texel. "Practical Path Guiding." https://texelatlas.vercel.app/t/path-guiding/ (accessed 2026-12-01).
