all lessons / computer_graphics / 11 · path tracing lesson 11 / 15

Monte Carlo path tracing蒙特卡洛路径追踪

Whitted ray tracing (lesson 10) only handled perfect mirrors and point lights — every other direction was ignored. But the rendering equation of lesson 07 is a full hemisphere integral, and it is recursive: the light arriving at a surface is the light leaving all other surfaces. That integral has no closed form. This lesson introduces the general tool used to estimate it — Monte Carlo integration — and builds it into a path tracer: shoot a ray, bounce it by random sampling, average the paths. We will meet the standard independent-sample cost law (standard error ∝ 1/√N, when variance is finite), the variance-reduction tricks that make it practical, and denoisers that trade exact estimator guarantees for usable images. Whitted 光线追踪(第 10 课)只处理了完美镜面与点光源——其余每个方向都被忽略了。但第 07 课的渲染方程是一个完整的半球积分,而且是递归的:到达一个表面的光,正是所有其他表面离开的光。这个积分没有闭式解。这一课引入估计它所用的通用工具——蒙特卡洛积分——并把它搭成一台路径追踪器:射出一条光线,用随机采样让它反弹,再把路径平均起来。我们会遇到独立采样的标准代价定律(方差有限时,标准误差 ∝ 1/√N)、让它变得实用的降方差技巧,以及用精确估计保证换取可用图像的降噪器。

The plan本课计划

Five moves. (1) Why Monte Carlo: the integral is high-dimensional and recursive, so no analytic answer exists — but with correct support and weighting, a random average (1/N)Σ f(xi)/p(xi) is unbiased; independent finite-variance samples have standard error 1/√N. (2) The path-tracing loop: trace from the eye, at each hit sample one bounce, attenuate by BRDF·cosθ/pdf, accumulate emission, average many paths per pixel. (3) Importance sampling, next-event estimation, and MIS: choose useful proposals, then combine overlapping estimators without double counting. (4) Russian roulette: end paths without bias. (5) Noise & denoising: reduce variance at the estimator; recognize that a denoised display is usually biased. Then lesson 12 asks how to get any of this in real time.

五步走。(1) 为什么用蒙特卡洛:积分高维且递归,故无解析解——但只要支撑域与权重正确,随机平均 (1/N)Σ f(xi)/p(xi) 就是无偏的;独立且方差有限的样本,其标准误差按 1/√N 下降。(2) 路径追踪循环:从眼睛出发追踪,每次命中采样一次反弹,用 BRDF·cosθ/pdf 衰减,累加自发光,把每个像素的许多条路径平均。(3) 重要性采样下一事件估计MIS:选择有用的提议分布,再合并重叠估计器而不重复计数。(4) 俄罗斯轮盘赌:无偏地终止路径。(5) 噪声与降噪:先在估计器处降低方差;同时承认降噪后的显示结果通常有偏。随后第 12 课要问:这一切如何实时做到。

1 · Why Monte Carlo — the integral has no closed form为什么用蒙特卡洛——积分没有闭式解

Recall the rendering equation from lesson 07: the light leaving a point x toward the eye is an integral over the whole hemisphere of directions, Lo = Le + ∫Ω fr·Li·(ωi·n) dωi. Two facts make this brutal. First, Li — the light arriving along ωi — is itself the Lo of whatever surface that direction sees, so the equation is recursive: a bounce contains another integral, which contains another. Second, each bounce adds two more dimensions (a direction on a hemisphere). A path of k bounces is a 2k-dimensional integral. There is no antiderivative to write down.

回忆第 07 课的渲染方程:从点 x 射向眼睛的光,是在整个半球方向上的一个积分,Lo = Le + ∫Ω fr·Li·(ωi·n) dωi。两个事实让它极其棘手。其一,Li——沿 ωi 到达的光——本身就是那个方向所看到表面的 Lo,所以方程是递归的:一次反弹里含着又一个积分,那里面又含着一个。其二,每次反弹多出两个维度(半球上的一个方向)。一条 k 次反弹的路径就是一个 2k 维积分。根本写不出原函数。

When you cannot integrate analytically, you estimate. The key identity of Monte Carlo integration: to estimate I = ∫ f(x) dx, draw samples xi from any probability density p(x) (with p>0 wherever f≠0), and average f re-weighted by 1/p:

当你无法解析地积分时,你就去估计。蒙特卡洛积分的核心恒等式:要估计 I = ∫ f(x) dx,从任意概率密度 p(x) 抽取样本 xi(只要在 f≠0 处都有 p>0),再对用 1/p 重新加权后的 f 求平均:

I ≈ <I>N = (1/N) Σi=1..N f(xi) / p(xi)

Why is this legitimate? Because on average it lands on the right answer—provided p(x)>0 everywhere the integrand contributes and every sample is weighted by the density that actually generated it. Then E[f(x)/p(x)] = ∫ (f(x)/p(x))·p(x) dx = ∫ f(x) dx = I: the p cancels exactly. Under those conditions the estimator is unbiased for any N. Missing support, using a density in the wrong measure, dropping a Jacobian, clamping contributions, or double-counting a light path breaks that proof.

这为什么合理?因为它平均而言正好落在正确答案上——前提是被积函数有贡献之处都满足 p(x)>0,且每个样本都按真正生成它的密度加权。此时 E[f(x)/p(x)] = ∫ (f(x)/p(x))·p(x) dx = ∫ f(x) dx = Ip 恰好抵消。在这些条件下,估计器对任意 N无偏。支撑域缺失、用错密度的测度、漏掉 Jacobian、钳制贡献或重复计算一条光路,都会破坏这段证明。

Averaging N independent, identically distributed samples divides the variance by N, assuming that variance is finite. Variance is in squared units; the standard error is its square root. So for ordinary IID Monte Carlo:

N 个独立同分布样本平均,会把方差除以 N——前提是方差有限。方差是平方量纲;标准误差是其平方根。所以对普通 IID 蒙特卡洛:

Var[<I>N] = σ² / N   ⟹   stderr = σ / √N   ∝   1 / √N

This is the baseline cost law for ordinary IID path sampling, and it is unforgiving: halving standard deviation needs the samples because 1/√(4N) = (1/2)·(1/√N). Worked number: if 100 IID samples give σ/10, then σ/20 needs 400, σ/40 needs 1600, and σ/80 needs 6400. Importance sampling changes σ; stratified and randomized low-discrepancy designs also introduce dependence and can converge faster on favorable integrands, so 1/√N is a baseline—not a universal law for every sequence and scene.

这是普通 IID 路径采样的基准代价定律,而且它毫不留情:要把标准差减半,需要 的样本,因为 1/√(4N) = (1/2)·(1/√N)。算个数:若 100 个 IID 样本给出 σ/10,则 σ/20 需 400 个,σ/40 需 1600 个,σ/80 需 6400 个。重要性采样会改变 σ;分层与随机化低差异设计还会引入相关性,并可能在有利的被积函数上收敛更快。因此 1/√N 是基线,而不是对所有序列与场景都成立的普遍定律。

Bias vs variance — keep them straight偏差 vs 方差——别搞混

Variance is run-to-run spread; bias is systematic offset from the intended light-transport integral. A correctly weighted path estimator with full support and unbiased termination is unbiased. A practical renderer may not be: firefly clamping, finite depth caps, approximate visibility/materials, and denoisers change the target or output. More samples converge to the implemented estimator's expectation; they cannot remove its bias. Those trades are often worthwhile, but name and measure them.

方差是不同运行之间的散布;偏差是相对目标光传输积分的系统偏移。支撑域完整、权重正确且终止无偏的路径估计器是无偏的。实用渲染器却未必如此:萤火虫钳制、有限深度上限、近似可见性 / 材质与降噪器都会改变目标或输出。更多样本只能收敛到已实现估计器的期望,无法消除它的偏差。这些取舍通常值得,但必须说清并测量。

2 · The path-tracing loop — the recursion, sampled路径追踪循环——把递归采样出来

Path tracing is the rendering equation with its recursion unrolled by sampling. Start at the eye and shoot a ray through a pixel (lesson 10 gave us the ray, and the BVH gave us fast intersection). At the first hit, we want Lo — an integral. Instead of integrating, sample one incoming direction ωi from some pdf, follow the ray that way, and let the recursion continue at the next surface. Each term fr·Li·cosθ gets divided by the pdf of the direction we chose — the Monte Carlo re-weighting from section 1.

路径追踪就是把递归用采样展开的渲染方程。从眼睛出发,射一条光线穿过某个像素(第 10 课给了我们光线,BVH 给了我们快速求交)。在第一个命中点,我们想要 Lo——一个积分。不去积分,而是从某个 pdf 采样一个入射方向 ωi,沿那条光线走下去,让递归在下一个表面继续。每一项 fr·Li·cosθ 都要除以我们所选方向的 pdf——正是第 1 节的蒙特卡洛重新加权。

Rather than literal recursion, we carry a running throughput β — the product of all the fr·cosθ/pdf factors so far — and whenever we hit an emitter, add β·Le to the pixel. One camera ray traces one full path; a pixel's color is the average of many such paths (its samples per pixel, spp):

与其真的递归,我们携带一个不断累乘的通量 β——到目前为止所有 fr·cosθ/pdf 因子的乘积——每当命中一个发光体,就把 β·Le 加到该像素上。一条相机光线追踪一条完整路径;一个像素的颜色是许多这样路径的平均(它的每像素样本数,spp):

radiance_estimate(ray): L = 0 # accumulated radiance for this path β = 1 # throughput (product of BRDF·cos/pdf so far) for bounce in 0 .. infinity: hit = intersect(scene, ray) # BVH from lesson 10 if no hit: L += β · sky(ray); break L += β · hit.emission # emitter reached along this path ωi, pdf = sample_direction(hit.bsdf, hit.shadingNormal) β *= bsdf(hit, ωi) · absdot(hit.shadingNormal, ωi) / pdf if bounce >= rrStart: # compensated, not a hard cap q = clamp(max_channel(β), qMin, qMax) if uniform_random() > q: break β /= q ray = spawn_ray(hit.point, ωi, hit.geometricNormal) # robust offset return L # pixel = average over spp calls; IID, stratified, or randomized-QMC designs differ

Read the loop against lesson 07's equation. The Le term is the hit.emission line. The integral ∫ frLicosθ becomes "sample one ωi, multiply β by frcosθ/pdf, recurse into Li." The loop has no hard maximum depth: after a few mandatory bounces, section 4's compensated roulette ends it almost surely while preserving expectation. In principle, random bounces can discover the following effects; in practice, rare paths can have enormous variance and need the sampling strategies in section 3:

把这个循环对照第 07 课的方程读。Le 项就是 hit.emission 那行。积分 ∫ frLicosθ 变成了“采样一个 ωi,把 β 乘以 frcosθ/pdf,递归进 Li”。循环没有硬性的最大深度:先保证几次反弹,再由第 4 节带补偿的轮盘赌以概率 1 终止,同时保持期望。原则上随机反弹能发现下列效果;实践中稀有路径可能带来极大方差,需要第 3 节的采样策略。

EffectWhy it emerges for free
Soft shadowsAn area light is partly visible from the penumbra; the fraction of bounce rays that reach it varies smoothly.
Colour bleedingA bounce off a red wall multiplies β by a red BRDF, tinting whatever light it carries onward.
Glossy reflectionThe BRDF's lobe is wide, not a mirror spike, so sampled bounce directions spread — a blurred reflection.
Indirect lightLight reaching a surface after ≥2 bounces is exactly the recursion the loop unrolls.
效果为什么它自然出现
软阴影面光源从半影区部分可见;反弹光线中到达它的比例平滑变化。
颜色渗透从红墙反弹会把 β 乘上一个红色 BRDF,给它此后携带的光染色。
光泽反射BRDF 的波瓣是宽的、而非镜面尖峰,故采样的反弹方向散开——一次模糊的反射。
间接光经 ≥2 次反弹才到达表面的光,正是这个循环展开的递归。

3 · Importance sampling & next-event estimation重要性采样与下一事件估计

Section 1 said we may draw from any pdf p whose support covers the integrand—provided we divide by the actual generating density in the same measure, including required Jacobians. Under that contract, changing the proposal does not change expectation, but it can dramatically change variance. This is importance sampling: put samples where the magnitude of the integrand is large. For a nonnegative integrand, variance is zero in the idealized case p ∝ f; for a signed scalar integrand the optimum uses |f|. A renderer cannot sample the full product exactly because unknown incident radiance is part of it, but it can match known factors.

第 1 节说过,只要支撑域覆盖被积函数,我们可以从任意 pdf p 抽样——前提是除以同一测度下真正生成样本的密度,并包含所需 Jacobian。在这份契约下,改变提议分布不改变期望,却会剧烈改变方差。这就是重要性采样:把样本放在被积函数幅值大的地方。对非负被积函数,理想情况 p ∝ f 的方差为零;对有正负号的标量被积函数,最优分布使用 |f|。渲染器无法精确采样完整乘积,因为未知的入射辐亮度就在其中,但它能匹配已知因子。

But importance sampling by the BRDF alone has a blind spot: a small, bright light. A random cosine-weighted bounce from a diffuse surface almost never happens to point straight at a tiny lamp, so the light is found rarely — and each rare hit carries huge energy divided by a tiny pdf, producing bright speckles ("fireflies"). The fix is next-event estimation (NEE), also called direct light sampling: at every bounce, also sample a point on the light sources directly and add its shadow-ray-tested contribution. If sampling in area, convert that area pdf to the solid-angle measure used by the BSDF estimator before comparison or MIS. Direct-light variance is then usually much lower because the proposal deliberately covers the emitters.

但只靠 BRDF 做重要性采样有个盲点:又小又亮的光源。从漫反射面随机的余弦加权反弹,几乎从不会正好指向一盏小灯,所以光源很少被找到——而每次罕见的命中都带着巨大能量除以极小的 pdf,产生明亮的斑点(“萤火虫”)。解法是下一事件估计(NEE),也叫直接光照采样:在每次反弹时,额外直接在光源上采样一个点,加上经阴影光线检验的贡献。若在面积上采样,比较或做 MIS 前要把面积 pdf 转换到 BSDF 估计器所用的立体角测度。由于提议分布主动覆盖发光体,直接光方差通常会低得多。

Two good strategies → combine them with MIS两个好策略 → 用 MIS 结合

Now we have two proposals for the same direct-light paths: sample the BSDF (often strong for glossy transport) and sample the light (often strong for a small emitter). Multiple importance sampling (MIS) combines their estimators using weights such as the balance or power heuristic. Correctness has contracts: evaluate competing pdfs in the same measure (usually solid angle, including the area-to-angle Jacobian); weights for strategies capable of generating the same sample must sum to one; and delta events need special handling because an ordinary density cannot generate them. Under those conditions MIS preserves unbiasedness and is usually robust, but no heuristic guarantees the lowest variance for every scene.

现在我们有两种生成同一组直接光路径的提议分布:采样 BSDF(常擅长光泽传输)与采样光源(常擅长小发光体)。多重重要性采样(MIS)用 balance 或 power 等启发式权重合并两者的估计。正确性有明确契约:竞争 pdf 必须在同一测度下求值(通常是立体角,并包含面积到角度的 Jacobian);能生成同一样本的各策略权重之和必须为一;delta 事件还要特殊处理,因为普通密度无法生成它。满足这些条件时 MIS 保持无偏且通常很稳健,但没有哪种启发式能保证在每个场景都达到最低方差。

NEE and emitter hits overlapNEE 与命中发光体会重叠

The section-2 loop adds emission when a BSDF-sampled ray hits a light; NEE estimates many of those same paths by sampling the light explicitly. Adding both full contributions would double-count direct lighting. A complete implementation either MIS-weights the emitter hit against the light-sampling pdf, or only accepts unweighted emission on camera/specular paths where NEE could not generate the same path. This bookkeeping—not the acronym—is what preserves the estimator.

第 2 节的循环会在 BSDF 采样的光线命中光源时累加自发光;NEE 又通过显式采样光源估计许多相同路径。若把两份完整贡献直接相加,就会重复计算直接光。完整实现要么用光源采样 pdf 对发光体命中做 MIS 加权,要么只在相机 / 镜面路径这类 NEE 无法生成同一路径时接受未加权自发光。真正保持估计器正确的是这套记账,而不是 MIS 这个缩写。

4 · Russian roulette — ending paths without bias俄罗斯轮盘赌——无偏地终止路径

The loop in section 2 needs to stop. A path could in principle bounce forever, and after many bounces the throughput β is tiny — those paths cost intersection tests but barely change the image. The naive fix is a hard depth cap ("stop after 8 bounces"), but that throws away all the energy of deeper paths and darkens the image: it introduces bias. We want to stop paths on average without losing energy on average.

第 2 节的循环需要停下来。原则上一条路径可以永远反弹下去,而在多次反弹后通量 β 已很小——这些路径耗费求交测试却几乎不改变图像。朴素的解法是硬性的深度上限(“8 次反弹后就停”),但那会丢掉更深路径的全部能量并让图像变暗:它引入了偏差。我们想要平均而言停下路径、又平均而言不损失能量。

Russian roulette does exactly that. At a bounce, pick a survival probability q (often tied to β, e.g. its max channel). Draw a uniform sample: with probability 1−q, kill the path (contribute nothing further); otherwise it survives, and we divide its throughput by q to compensate. The division is the whole trick — it makes the estimator unbiased:

俄罗斯轮盘赌正是这么做的。在一次反弹处,取一个存活概率 q(常与 β 挂钩,例如取其最大通道)。抽一个均匀样本:以概率 1−q 杀死路径(此后不再贡献);否则它存活,我们把它的通量除以 q 来补偿。这个除法就是全部诀窍——它让估计量无偏:

E[contribution] = q · (β / q)·Lrest + (1−q) · 0 = β · Lrest

The killed paths contribute zero; the survivors are boosted by 1/q to carry the load of the ones that died. In expectation the total energy is unchanged — same answer, fewer average bounces, no darkening. The cost is a little extra variance (survivors are noisier because they are scaled up), but it is a good trade: you spend samples on paths that still matter. Worked number: with q=0.9 per bounce, the expected path length is 1/(1−0.9) = 10 bounces, but a stubborn path can still go deeper occasionally — so a faint caustic that needs 15 bounces is not silently clipped to black.

被杀死的路径贡献零;存活者被放大 1/q 倍,替死去的那些扛起负担。期望上总能量不变——同样的答案、更少的平均反弹、不变暗。代价是一点额外方差(存活者因被放大而更吵),但这是笔好交易:你把样本花在仍然要紧的路径上。算个数:每次反弹取 q=0.9,期望路径长度是 1/(1−0.9) = 10 次反弹,但顽固的路径偶尔仍能走得更深——所以一处需要 15 次反弹的微弱焦散不会被悄悄裁成全黑。

5 · Noise & denoising — from grain to clean frames噪声与降噪——从颗粒到干净画面

Everything above still leaves variance, and in a path-traced image it appears as grain. First reduce it at the estimator: more IID samples follow the 1/√N baseline; importance sampling, NEE, and MIS reduce the variance constant; stratification prevents clumping in selected dimensions. Low-discrepancy and randomized quasi-Monte Carlo (RQMC) designs can substantially outperform IID sampling on sufficiently regular, effectively low-dimensional integrands. But path-space visibility is discontinuous and high-dimensional, so there is no universal 1/N image-error guarantee. Randomization is especially useful because it can retain unbiasedness and enable replicated error estimates; a deterministic sequence alone supplies neither guarantee.

上面这一切仍会留下方差,而在路径追踪图像里它表现为颗粒。第一步是在估计器处降方差:更多 IID 样本遵循 1/√N 基线;重要性采样、NEE 与 MIS 降低方差常数;分层则防止选定维度里的样本扎堆。对足够规则、有效维度较低的被积函数,低差异与随机化准蒙特卡洛(RQMC)设计可能显著胜过 IID 采样。但路径空间可见性不连续且维度很高,因此不存在普遍的 1/N 图像误差保证。随机化尤其有用,因为它可以保留无偏性,并允许通过重复运行估计误差;单独一条确定性序列两者都不保证。

Second, denoise the displayed result. A real-time budget may afford only 1–8 spp. Edge-aware filters and modern ML denoisers use albedo, normals, depth, motion, and history to predict a clean-looking image. They can blur texture, ghost motion, hallucinate detail, or fail out of distribution; even a visually excellent result is not an additional Monte Carlo sample and is generally a biased post-process. Keep the raw accumulation for convergence/debugging, validate temporal stability and difficult slices, and judge the denoiser on task-relevant image error—not only whether one frame looks smooth.

第二步是给显示结果降噪。实时预算可能只有 1–8 spp。边缘感知滤波器与现代 ML 降噪器利用反照率、法线、深度、运动与历史帧去预测一张看起来干净的图。它们可能抹掉纹理、产生运动拖影、幻觉细节,或在分布外失效;即使视觉效果极好,它也不是额外的蒙特卡洛样本,通常仍是有偏后处理。应保留原始累积结果用于收敛 / 调试,验证时间稳定性与困难切片,并按任务相关图像误差评价降噪器,而不只是看单帧是否平滑。

Deterministic coverage versus the IID 1/√N reference确定性覆盖与 IID 的 1/√N 参考
We estimate a known 2D integral: the fraction of N unit-square points inside a quarter circle gives π ≈ 4·inside/N. The blue ±k/√N band is only an IID Monte Carlo scale reference, not a confidence interval for these deterministic points. The orange deterministic estimate may be non-monotonic and may leave the band. Halton often covers this toy square more evenly than the deliberately clumping sequence, but one example is not a universal variance or convergence guarantee—especially not for discontinuous, high-dimensional path space. Randomized/scrambled low-discrepancy sequences are normally preferred when unbiasedness and error bars matter.我们估计一个已知二维积分:N 个单位正方形点中落在四分之一圆内的比例给出 π ≈ 4·内部/N。蓝色 ±k/√N 带只是 IID 蒙特卡洛的尺度参考,不是这些确定性点的置信区间。橙色确定性估计可能不单调,也可能跑出带外。Halton 在这个玩具正方形上通常比刻意扎堆的序列覆盖得更均匀,但一个例子并不是普遍的方差或收敛保证——尤其不能代表不连续、高维的路径空间。需要无偏性与误差条时,通常应使用随机化 / 扰乱后的低差异序列。
N samples
estimate of π
|error| = |est − π|
IID 1/√N reference
Show the core JS查看核心 JS
// Deterministic low-discrepancy sampling — NO Math.random.
// van der Corput radical inverse: mirror i's digits (base b) about the point.
function radicalInverse(i, base){
  var f = 1, r = 0;
  while (i > 0){ f /= base; r += f * (i % base); i = Math.floor(i / base); }
  return r;                       // in [0,1)
}
// Halton 2D: coordinate x from base 2, y from base 3 — evenly covers the square.
function halton2(i){ return [ radicalInverse(i,2), radicalInverse(i,3) ]; }

// Estimate pi: fraction of points inside the quarter unit circle, times 4.
var inside = 0;
for (var i = 1; i <= N; i++){
  var p = halton2(i);             // deterministic sample
  if (p[0]*p[0] + p[1]*p[1] <= 1) inside++;
}
var estimate = 4 * inside / N;    // deterministic error; no IID confidence claim

Where this points next接下来指向何处

We now have the ingredients for an unbiased raw estimator: correct support and pdfs, path throughput, MIS bookkeeping, and compensated Russian roulette. Under the renderer's scene, material, spectral, and numerical model, that raw accumulation can converge to its target light-transport integral. A hard depth cap, clamping, or denoising changes the guarantee; the denoised display may look better while no longer being an unbiased estimate. Offline rendering spends minutes or hours reducing raw error. Lesson 12 asks how to trade accuracy, latency, and temporal stability inside a 16.7 ms frame: precomputed probes, screen-space methods, and low-spp-plus-denoiser pipelines. Same underlying transport, different estimator and budget contracts.

我们现在具备了构造无偏原始估计器的要素:正确的支撑域与 pdf、路径通量、MIS 记账,以及带补偿的俄罗斯轮盘赌。在渲染器所采用的场景、材质、光谱与数值模型内,这份原始累积可以收敛到目标光传输积分。硬深度上限、钳制或降噪都会改变保证;降噪显示可能更好看,却不再是无偏估计。离线渲染用数分钟乃至数小时降低原始误差。第 12 课则问如何在 16.7 毫秒 内权衡精度、延迟与时间稳定性:预计算探针、屏幕空间方法,以及低 spp + 降噪器流水线。底层传输相同,估计器与预算契约不同。

Takeaway要点

Monte Carlo estimates the recursive rendering integral with (1/N)Σ f(xi)/p(xi). It is unbiased only when proposals cover every contributing path, pdfs and Jacobians match how samples were generated, overlapping strategies are combined without double counting, and termination is compensated. For IID finite-variance samples, standard error follows the 1/√N baseline; structured and randomized low-discrepancy designs may do better on favorable integrands but have no universal image-rate guarantee. Path tracing carries β·=frcosθ/pdf; importance sampling, NEE, and correctly measured MIS reduce variance; Russian roulette preserves expectation via the 1/q survivor weight. Denoisers can produce useful low-spp frames, but they are generally biased predictors, not proof that the raw integral has converged.

蒙特卡洛用 (1/N)Σ f(xi)/p(xi) 估计递归渲染积分。只有当提议分布覆盖每条有贡献的路径、pdf 与 Jacobian 符合样本的真实生成方式、重叠策略合并时不重复计数、且终止带补偿时,它才无偏。对方差有限的 IID 样本,标准误差遵循 1/√N 基线;结构化与随机化低差异设计可能在有利被积函数上更快,却没有普遍的图像速率保证。路径追踪携带 β·=frcosθ/pdf;重要性采样、NEE 与测度正确的 MIS 降低方差;俄罗斯轮盘赌通过存活者的 1/q 权重保持期望。降噪器能产出可用的低 spp 帧,但它们通常是有偏预测器,并不能证明原始积分已经收敛。

Interview prompts面试题