Practical Path Guiding
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.
Also known as guided path tracing, SD-tree guiding
In the family Light transport & global illumination, adaptive sampling
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | Built in | Properties > Render > Sampling > Path Guiding docs CPU only. |
| WebGPU W3C | None found | |
| Metal | None found |
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 choose it
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
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 Unidirectional Path Tracing with Multiple Importance Sampling for simple scenes, since learning costs memory and time. Prefer Metropolis Light Transport for the most constrained paths where adaptive proposals still fail. Prefer Neural Radiance Caching for real-time budgets, since guiding still needs many samples per pixel.
Field marks
- 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
Presets
Practical Path Guiding — cosine hemisphere noise (left) vs SD-tree directional guiding lobes (right)
{
"P_GUIDE_SHARP": 0.85,
"P_LOBE_VIS": 0.85,
"P_LIGHT_ORBIT": 0.65,
"P_SPLIT": 0.48
}Show GLSL (106 lines)
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.
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| path-guiding-live | Tesla T4 1920x1080 | 3.30× baseline (light) · 0.109 ms / 0.111 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| path-guiding-live | NVIDIA L4 1920x1080 | 2.56× baseline (light) · 0.041 ms / 0.043 ms · 2.7× faster on L4 | opengl-timer-query · Cross-architecture validation |
| path-guiding-live | NVIDIA A100-SXM4-40GB 1920x1080 | 1.99× baseline (feather) · 0.057 ms / 0.057 ms · 1.9× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Vertex Connection and Merging, Instant Radiosity (Virtual Point Lights); cited by Delta (Woodcock) Tracking, Manifold Next-Event Estimation and Specular Manifold Sampling, Neural Radiance Caching, ReSTIR GI: Path Resampling for Real-Time Path Tracing, ReSTIR PT and Generalized Resampled Importance Sampling, Ray-marched Participating Media.
Crosses
- Multiple Importance Sampling: One-sample MIS between the learned guide and BSDF sampling keeps the combined estimator robust and unbiased.
Sources
- primaryThomas Müller, Markus Gross, Jan Novák (2017). Practical Path Guiding for Efficient Light‐Transport Simulation. Computer Graphics Forum.Verified via crossref · 2026-11-29doi:10.1111/cgf.13227