Multiple Importance Sampling
Combines several sampling strategies for the same integral with weights that bound the variance of the sum. In rendering it merges light sampling and BSDF sampling so neither failure mode dominates.
Also known as MIS, balance heuristic, power heuristic
In the family Light transport & global illumination, Monte Carlo light transport
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | Built in | new BABYLON.IblCdfGenerator(engine) builds cumulative distribution function textures for IBL importance sampling docs |
| Godot 4.7 | None found | |
| Unity | None found | HDRP path tracing uses MIS internally but exposes no user-facing option. |
| Unreal 5.7 | Built in | Path Tracer and MegaLights combine light and BRDF importance sampling for HDRI skylight and area emitters docs |
| Blender 5.2 | Built in | Light Properties > Settings > Multiple Importance (Cycles); World > Settings > Multiple Importance docs |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Any single sampling distribution is good for some integrands and terrible for others. Sampling a glossy BSDF finds the specular lobe but misses a small lamp; sampling the lamp finds the lamp but wastes samples against a sharp lobe. MIS draws samples from both strategies and weights each sample so the weights for any given direction sum to one.
The balance heuristic weights a sample from strategy i by n_i p_i(x) / sum_j n_j p_j(x). The power heuristic raises each pdf to a power (usually 2) before normalizing, which sharpens the preference for whichever strategy is clearly better at that direction. Because the weights depend on the pdf of every strategy at the sampled point, you must be able to evaluate both pdfs for any direction, including the one you did not draw.
In a path tracer this appears at every vertex: one light sample and one BSDF sample, each weighted by the other's density. The same idea generalizes over path-space strategies in bidirectional methods, and it is the algebra behind resampled importance sampling in ReSTIR.
When to choose it
Reach for it when
- path tracer is noisy with small bright lights
- glossy surfaces and area lights give fireflies
- one sampling strategy works only for some materials
- combine light sampling and brdf sampling without bias
Choose it whenever an estimator mixes at least two sampling strategies: direct lighting with next-event estimation, environment map plus BSDF sampling, or bidirectional connections. It is essentially free and always safe to add.
Prefer a single strategy only when the other is degenerate, for example a delta light (cannot be hit by BSDF sampling) or a perfect mirror (cannot be sampled from a light). Prefer ReSTIR DI: Spatiotemporal Reservoir Resampling for Direct Lighting when you have thousands of lights, since MIS alone still needs an importance function over all of them. Many-light structures such as Light BVH and Adaptive Tree Splitting supply the light-side pdf that MIS then combines.
Field marks
- Wrong results if the pdf used for the weight does not exactly match the density the sample was drawn from (missing cosine, wrong solid-angle vs area measure)
- Lights with delta distributions need special handling: BSDF sampling gets weight 0 for them, light sampling gets weight 1
- Balance heuristic is not variance-optimal, and the power heuristic can lose when strategies have comparable quality
- Shadow rays are required for the light strategy; an occluded light sample is wasted weight that BSDF sampling cannot recover
Presets
Multiple Importance Sampling — classic Veach glossy-plate benchmark (naive sampling vs balance-heuristic MIS)
{
"P_MIS_QUALITY": 1,
"P_EXPOSURE": 1.15,
"P_LIGHT_SWAY": 1,
"P_SPLIT": 0.46
}Show GLSL (135 lines)
const float P_MIS_QUALITY = 1.0; // P MIS Variance Fix [0.0, 1.0, 0.02]
const float P_EXPOSURE = 1.15; // P Exposure [0.4, 2.2, 0.05]
const float P_LIGHT_SWAY = 1.0; // P Light Motion [0.0, 2.5, 0.05]
const float P_SPLIT = 0.46; // P Naive / MIS Split [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);
}
// Evaluate GGX microfacet specular lobe + solid-angle area-light contribution from spherical light
vec3 evalSphereLight(vec3 p, vec3 n, vec3 v, vec3 lCenter, float lRad, vec3 lCol, float rough) {
vec3 toL = lCenter - p;
float dist = length(toL);
vec3 lDir = toL / max(dist, 1e-4);
// Representative closest point on sphere to reflection ray R for crisp area-light specular
vec3 rVec = reflect(-v, n);
vec3 centerToRay = dot(toL, rVec) * rVec - toL;
vec3 closestPt = lCenter + centerToRay * clamp(lRad / max(length(centerToRay), 1e-4), 0.0, 1.0);
vec3 lSpec = normalize(closestPt - p);
float a = max(rough * rough, 0.008);
// Sphere angular radius energy normalization (Karis alpha' broadening)
float aPrime = clamp(a + lRad / max(2.0 * dist, 0.1), 0.01, 1.0);
float normFactor = (a * a) / max(aPrime * aPrime, 1e-5);
vec3 h = normalize(lSpec + v);
float ndh = max(dot(n, h), 0.0);
float ndl = max(dot(n, lDir), 0.0);
float denom = ndh * ndh * (aPrime * aPrime - 1.0) + 1.0;
float D = (aPrime * aPrime) / max(3.14159265 * denom * denom, 1e-5);
float F = 0.08 + 0.92 * pow(1.0 - max(dot(h, v), 0.0), 5.0);
// Constant total power across all 4 spheres: radiance scales inversely with area (1 / r^2)
float areaScale = 0.018 / max(lRad * lRad, 0.0004);
return lCol * areaScale * (D * F * normFactor * 0.24 + 0.025) * ndl / (1.0 + 0.18 * dist * dist);
}
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);
float misQual = clamp(P_MIS_QUALITY, 0.0, 1.0);
float expo = clamp(P_EXPOSURE, 0.3, 2.5);
float tAnim = iTime * max(P_LIGHT_SWAY, 0.0);
vec3 ro = vec3(0.0, 0.65, 3.15);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.16, -1.65));
// Classic Veach scene: 4 spherical area lights of increasing radius (tiny intense -> large soft)
vec3 lPos[4];
float lRad[4];
vec3 lCol[4];
float sway = 0.14 * sin(tAnim * 0.7);
lPos[0] = vec3(-1.12 + sway, 0.85, -1.25); lRad[0] = 0.055; lCol[0] = vec3(1.0, 0.42, 0.25);
lPos[1] = vec3(-0.38 + sway, 0.88, -1.25); lRad[1] = 0.115; lCol[1] = vec3(1.0, 0.82, 0.32);
lPos[2] = vec3(0.38 + sway, 0.92, -1.25); lRad[2] = 0.205; lCol[2] = vec3(0.28, 0.92, 0.68);
lPos[3] = vec3(1.18 + sway, 0.96, -1.25); lRad[3] = 0.320; lCol[3] = vec3(0.32, 0.64, 1.0);
vec3 col = mix(vec3(0.018, 0.024, 0.038), vec3(0.045, 0.058, 0.088), smoothstep(-0.4, 0.6, uv.y));
// Render the 4 glowing spherical Veach area lights directly in the upper frame
float tHit = 1e5;
for (int i = 0; i < 4; i++) {
vec3 oc = ro - lPos[i];
float b = dot(oc, rd);
float c = dot(oc, oc) - lRad[i] * lRad[i];
float disc = b * b - c;
if (disc > 0.0) {
float ts = -b - sqrt(disc);
if (ts > 0.0 && ts < tHit) {
tHit = ts;
float radBoost = clamp(0.18 / max(lRad[i], 0.04), 0.7, 3.2);
col = lCol[i] * radBoost * 1.4;
}
}
}
// Intersect 4 tilted horizontal glossy Veach plates (roughness: 0.06, 0.14, 0.26, 0.42)
for (int pIdx = 0; pIdx < 4; pIdx++) {
float fp = float(pIdx);
// Plates stepped downward and closer to camera, angled to reflect the 4 overhead spheres
vec3 pCenter = vec3(0.0, -0.46 + fp * 0.20, 0.55 - fp * 0.62);
vec3 pNorm = normalize(vec3(0.0, 0.88, 0.47 - fp * 0.05));
float denom = dot(rd, pNorm);
if (denom < -1e-4) {
float tp = dot(pCenter - ro, pNorm) / denom;
if (tp > 0.1 && tp < tHit) {
vec3 hp = ro + rd * tp;
vec3 rel = hp - pCenter;
float alongZ = dot(rel, normalize(cross(vec3(1.0, 0.0, 0.0), pNorm)));
if (abs(rel.x) < 1.52 && abs(alongZ) < 0.23) {
tHit = tp;
float rough = mix(0.055, 0.40, fp / 3.0);
vec3 vDir = -rd;
vec3 cleanSum = vec3(0.0);
vec3 noisySum = vec3(0.0);
float pxSeed = floor(fragCoord.x) + floor(fragCoord.y) * 57.0 + fract(iTime * 6.0) * 17.0;
for (int k = 0; k < 4; k++) {
vec3 contrib = evalSphereLight(hp, pNorm, vDir, lPos[k], lRad[k], lCol[k], rough);
cleanSum += contrib;
// Left side illustrates single-strategy estimator variance:
// BRDF sampling fails catastrophically on tiny lights (k=0,1) + rough plates;
// Light sampling fails on large lights (k=2,3) + mirror-like plates (fp=0)!
float rn = hash21(vec2(pxSeed + float(k) * 13.7, float(pIdx) * 29.3));
float mismatch = (k < 2) ? (rough * 2.2 / max(lRad[k] * 6.0, 0.25)) : ((0.45 - rough) * 1.9);
float spike = step(clamp(0.84 - mismatch * 0.35, 0.22, 0.92), rn) * (1.8 + 2.4 * mismatch);
noisySum += contrib * mix(0.32, spike, clamp(mismatch, 0.15, 1.0));
}
// Balance-heuristic MIS combines both PDFs -> dramatically suppresses both variance regimes!
vec3 misCol = mix(noisySum, cleanSum, misQual);
vec3 plateBase = vec3(0.035, 0.042, 0.056);
col = (plateBase + ((screenX < split) ? noisySum : misCol)) * expo;
// Crisp brushed metallic bevel edge on each Veach strip
float edge = smoothstep(0.20, 0.23, abs(alongZ));
col = mix(col, vec3(0.38, 0.45, 0.56), edge * 0.65);
}
}
}
}
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: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| multiple-importance-sampling-live | Tesla T4 1920x1080 | 8.12× baseline (moderate) · 0.255 ms / 0.262 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| multiple-importance-sampling-live | NVIDIA L4 1920x1080 | 6.58× baseline (moderate) · 0.104 ms / 0.107 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| multiple-importance-sampling-live | NVIDIA A100-SXM4-40GB 1920x1080 | 4.99× baseline (light) · 0.144 ms / 0.144 ms · 1.8× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): cited by Light BVH and Adaptive Tree Splitting, Manifold Next-Event Estimation and Specular Manifold Sampling, Neural Radiance Caching, Vertex Connection and Merging.
Crosses
- Unidirectional Path Tracing: Weights light-sampling and BSDF-sampling contributions at each path vertex.
- Light BVH and Adaptive Tree Splitting: The tree provides the light-side sampling pdf that MIS combines with the BSDF pdf.
Sources
- primaryEric Veach, Leonidas J. Guibas (1995). Optimally combining sampling techniques for Monte Carlo rendering. Proceedings of the 22nd annual conference on Computer graphics and interactive techniques - SIGGRAPH '95.Verified via crossref · 2026-11-29doi:10.1145/218380.218498
- implementationmmp (2017). mmp/pbrt-v4. Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.GitHub API · license Apache-2.0 · 2026-11-29