# 蒙特卡洛光线追踪

蒙特卡洛光线追踪是一类基于随机光线的渲染方法：通过对光路随机采样并对其贡献取平均，估计到达图像每个像素的光；本文大部分内容所描述的[路径追踪](https://www.edgepedia.org/zh/path-tracing)就是该家族的一员，与分布式光线追踪等技术并列。每条路径都是对连接光源与相机的所有光路之积分的一次随机采样，因此随着样本数增加，估计器收敛到真实像素辐射亮度，残余误差表现为噪声。该方法在精心构建时是无偏的，能处理任意几何、材质和光照，并且是 [Arnold](https://www.edgepedia.org/zh/arnold-software)、Hyperion、Manuka 和 RenderMan 等电影制作渲染器<sup>[1](https://cs.dartmouth.edu/~wjarosz/publications/novak18monte.pdf)</sup>以及 GPU 上新兴实时路径追踪器<sup>[2](https://papers.nips.cc/paper_files/paper/2023/file/d1422213c9f2bdd5178b77d166fba86a-Paper-Conference.pdf)</sup>的基础。

| 关键事实 | 数值 |
|---|---|
| 估计量 | 像素辐射亮度，作为对光路的蒙特卡洛积分<sup>[3](https://doi.org/10.1145/15886.15902)</sup> |
| 核心方程 | 渲染方程（卡吉亚（Kajiya），1986），对入射方向半球面的递归积分<sup>[3](https://doi.org/10.1145/15886.15902)</sup> |
| 收敛性 | 方差与 \( 1/N \) 成正比；标准差与 \( 1/\sqrt{N} \) 成正比，因此采样数增至四倍可使误差减半 |
| 典型离线样本数 | 高质量图像每像素数百至数千个样本<sup>[4](https://www.pbr-book.org/3ed-2018/Light_Transport_I_Surface_Reflection/Path_Tracing)</sup> |
| 场景复杂度扩展 | 经验上随场景元素呈对数增长，而最快的有限元方法为 \( O(N \log N) \) |
| 实时预算 | 每帧低于 30 毫秒；在近期一款 GPU 上，对一百万像素约每像素 0–4 个样本<sup>[2](https://papers.nips.cc/paper_files/paper/2023/file/d1422213c9f2bdd5178b77d166fba86a-Paper-Conference.pdf)</sup> |

## 工作原理

渲染方程表达表面点处的能量平衡：出射辐射亮度等于发射辐射亮度加上对半球面积分的反射入射辐射亮度<sup>[5](https://cs184.eecs.berkeley.edu/public/sp22/lectures/lec-13-global-illumination-and-path-tra/lec-13-global-illumination-and-path-tra.pdf)</sup>，

\[ L_{o}(p, \omega_{o}) = L_{e}(p, \omega_{o}) + \int_{H^{2}} f_{r}(p, \omega_{i} \to \omega_{o}) \, L_{i}(p, \omega_{i}) \cos\theta_{i} \, d\omega_{i} \]

卡吉亚于 1986 年将这一积分方程作为已知渲染算法的推广提出，并勾勒了其蒙特卡洛解法<sup>[3](https://doi.org/10.1145/15886.15902)</sup>。在算子形式下，该方程写作 \( L = L_{e} + K(L) \)，是一个递归的弗雷德霍尔姆方程，其诺伊曼展开对光的逐次弹射求和；每个弹射项对应具有 1、2、3 个及更多顶点的路径<sup>[5](https://cs184.eecs.berkeley.edu/public/sp22/lectures/lec-13-global-illumination-and-path-tra/lec-13-global-illumination-and-path-tra.pdf)</sup>。由于完整路径空间积分依路径长度可包含数百个维度，确定性求积表现不佳，[蒙特卡洛积分](https://www.edgepedia.org/zh/monte-carlo-integration)是首选方法<sup>[6](https://jo.dreggn.org/path-tracing-in-production/2019/ptp-part1.pdf)</sup>。每条追踪路径贡献一个加权样本；对样本取平均得到像素值，估计器方差直接表现为图像中的噪声<sup>[7](http://15462.courses.cs.cmu.edu/spring2019content/lectures/18_montecarlo/18_montecarlo_slides.pdf)</sup>。

## 实现方式

路径追踪器从相机为每个像素生成一条光线，然后增量式构建路径：在每个顶点对 BSDF（表面散射函数）采样以选取新方向，并追踪一条光线以找到下一个最近交点<sup>[4](https://www.pbr-book.org/3ed-2018/Light_Transport_I_Surface_Reflection/Path_Tracing)</sup>。基于 BSDF 的增量式构建可处理完美镜面等 delta BSDF；而点光源等 delta 光源需要显式光源采样或其他专门策略，因为 BSDF 采样可能选到根本不会与光源相交的方向<sup>[8](https://pbr-book.org/4ed/Light_Transport_I_Surface_Reflection/Path_Tracing)</sup>。

**直接光照与间接光照被分开处理。** 在每个顶点，下一事件估计（NEE）向发光体上采样点投射阴影光线以估计直接光照，而 BSDF 采样处理间接光照；两个估计器必须用多重重要性采样（MIS）或混合采样结合，以避免重复计算<sup>[9](http://graphics.cs.cmu.edu/courses/15-468/2024_spring/lectures/lecture_11.pdf)</sup>。MIS 对不同概率密度构建的估计器进行最优加权，正是它使 MIS 路径追踪在直接光照下稳健；它被称为当今大多数渲染系统中的标准方法<sup>[10](https://ceur-ws.org/Vol-3027/paper1.pdf)</sup>。对于多光源，制作级追踪器通过重采样重要性采样选择候选：先评估约八个均匀选取的候选光源，再按贡献随机选取一个<sup>[11](https://developer.download.nvidia.com//ray-tracing-gems/rtg2-chapter14-preprint.pdf)</sup>。

**终止与累积。** 在固定深度截断会引入偏差，因此[俄罗斯轮盘](https://www.edgepedia.org/zh/russian-roulette)赌以概率方式终止递归，同时对存活项重新加权，从而保持无偏，代价是增加一些方差<sup>[9](http://graphics.cs.cmu.edu/courses/15-468/2024_spring/lectures/lecture_11.pdf)</sup>。pbrt 在三次弹射后基于路径吞吐量应用轮盘赌，取 \( q = \max(0.05, 1 - \beta_{y}) \)<sup>[4](https://www.pbr-book.org/3ed-2018/Light_Transport_I_Surface_Reflection/Path_Tracing)</sup>；一个参考路径追踪器将终止概率钳制在至多 0.95，并在按帧数归一化的 32 位浮点缓冲区中累积帧<sup>[11](https://developer.download.nvidia.com//ray-tracing-gems/rtg2-chapter14-preprint.pdf)</sup>。每像素数百至数千条路径以这种方式累积<sup>[5](https://cs184.eecs.berkeley.edu/public/sp22/lectures/lec-13-global-illumination-and-path-tra/lec-13-global-illumination-and-path-tra.pdf)</sup>。

## 起源

詹姆斯·T·卡吉亚（James T. Kajiya）于 1986 年在发表于 ACM SIGGRAPH Computer Graphics 的论文《渲染方程》（The rendering equation）中提出该方法，其中他提出了首个通过路径采样的完整、无偏蒙特卡洛传输算法<sup>[3](https://doi.org/10.1145/15886.15902)</sup>。这一脉络在埃里克·维奇（Eric Veach）关于稳健蒙特卡洛光传输的斯坦福大学博士论文中有叙述：阿佩尔（Appel）于 1968 年使用随机粒子追踪计算图像；惠特德（Whitted）于 1980 年引入递归光线追踪，并建议随机扰动观察光线；分布式光线追踪将这一思想扩展为对光源、镜头和时间进行随机采样<sup>[12](https://graphics.stanford.edu/papers/veach_thesis/thesis-bw.pdf)</sup>。卡吉亚本人的论文指出，渲染方程所描述的基本现象早已在辐射传热文献中得到研究<sup>[3](https://doi.org/10.1145/15886.15902)</sup>。路径追踪更深的根源在于 20 世纪 40 年代的蒙特卡洛中子输运模拟<sup>[13](https://cs.dartmouth.edu/~wjarosz/publications/christensen16path.pdf)</sup>。

## 变体

**路径追踪**从相机朝光源追踪随机路径，是基础算法。**双向路径追踪**由维奇和吉巴斯（Guibas）于 1995 年报告，从相机和光源两端构建子路径并将它们连接，对于长度为 \( k \) 的路径提供 \( k + 2 \) 种采样技术<sup>[14](https://doi.org/10.1007/978-3-642-87825-1_11)</sup>。**梅特罗波利斯光传输**通过随机变异单条当前路径生成一串路径，接受或拒绝变异，使路径按其贡献成比例地被采样；它无偏、占用存储少，并且在明亮间接光、小孔和光泽表面上可比此前的无偏方法高效数个数量级<sup>[15](https://graphics.stanford.edu/papers/metro/)</sup>。

**光子映射**从光源发射光子，追踪它们穿过场景，并根据存储的光子图估计光照；其标准形式有偏但一致，渐进式光子映射使估计逐步收敛<sup>[16](https://doi.org/10.1145/1409060.1409083)</sup>。**顶点连接与合并（VCM）**将光子映射重新表述为一种双向路径采样技术，在双向路径追踪的 \( k + 2 \) 种技术之外增加 \( k - 1 \) 种顶点合并技术，并用 MIS 将所有技术结合；其渐进形式可处理直接光照、漫反射与光泽互反射，以及镜面—漫反射—镜面（SDS）传输。一种比较性分类将朴素路径追踪和光子映射归为低效率的第一代，将重要性采样方法归为第二代，并将 MIS 路径追踪视为当前标准<sup>[10](https://ceur-ws.org/Vol-3027/paper1.pdf)</sup>。

## 应用

Arnold、Hyperion、Manuka 和 RenderMan 等电影制作渲染器建立在蒙特卡洛路径追踪之上，业界已从皮克斯（Pixar）的 REYES 等光栅化管线转向基于物理的蒙特卡洛渲染<sup>[17](https://inria.hal.science/hal-01252647v1/file/zwicker15star.pdf)</sup>。光子映射曾用于包括《[最终幻想：灵魂深处](https://www.edgepedia.org/zh/final-fantasy-the-spirits-within)》（Final Fantasy: The Spirits Within）、《魔发奇缘》（Tangled）和《冰雪奇缘》（Frozen）在内的电影中的专门焦散效果<sup>[13](https://cs.dartmouth.edu/~wjarosz/publications/christensen16path.pdf)</sup>。在颜色方面，制作级渲染器使用带路径复用的分层光谱采样，在 SIMD 通道中评估四个波长，并用 MIS 合并贡献；这一方法被维塔数码（Weta Digital）的 Manuka 渲染器采用<sup>[6](https://jo.dreggn.org/path-tracing-in-production/2019/ptp-part1.pdf)</sup>。在实时方面，ReSTIR 重采样在每帧不到 50 毫秒的时间内渲染了最多含 340 万个动态自发光三角形的场景，同时每像素最多追踪 8 条光线<sup>[18](https://doi.org/10.1145/3386569.3392481)</sup>；ReSTIR 家族现在涵盖直接光照、间接光照和完整路径追踪，而广义重采样重要性采样（GRIS）于 2022 年将该框架扩展到完整路径追踪<sup>[19](https://doi.org/10.1145/3528223.3530158)</sup>。

## 局限与替代方法

核心弱点是噪声和收敛缓慢，标准误差与 \( 1/\sqrt{N} \) 成比例下降，因此要将其减半需要四倍采样；优点是几何、BRDF 和路径类型上的通用性、低内存占用以及无偏性<sup>[20](https://cseweb.ucsd.edu/~viscomp/classes/cse168/sp24/lectures/168-lecture7.pdf)</sup>。蒙特卡洛估计器的方差与 \( 1/N \) 成正比，因此其标准差按 \( 1/\sqrt{N} \) 下降；误差减半需要采样数增至四倍。高质量路径追踪图像可能每像素需要数百或数千个样本，而无噪声结果的计算时间常常达到数分钟乃至数小时<sup>[17](https://inria.hal.science/hal-01252647v1/file/zwicker15star.pdf)</sup>。光栅化更高效，因为它在固定的 GPU 管线上运行，但它不基于物理的光—材质相互作用；光线追踪和辐射度是基于物理渲染的两大主要构件<sup>[21](https://sgvr.kaist.ac.kr/~sungeui/render/pbr/ray.pdf)</sup>。确定性有限元辐射度随场景元素呈超线性扩展，而蒙特卡洛的经验复杂度为 \( O(\log N) \)；蒙特卡洛方法还能处理程序化几何、任意 BRDF 和低内存预算。

路径追踪可能对焦散等数量稀少的高贡献路径采样不足，导致方差过大和渲染时间过长<sup>[22](https://benedikt-bitterli.me/smlt/bitterli19selectively.pdf)</sup>。光子映射可处理基于光线的方法难以处理的焦散，代价是有偏但一致的估计，且收敛速度慢于双向光线方法<sup>[10](https://ceur-ws.org/Vol-3027/paper1.pdf)</sup>。体积由辐射传输方程支配，该方程通过发射、消光和散射项描述一点处辐射亮度的变化；空碰撞（delta 追踪）自由飞行程序处理空间变化的密度，并采用从中子输运引入的碰撞、径迹长度和加权径迹长度透射率估计器，由 MIS 结合<sup>[1](https://cs.dartmouth.edu/~wjarosz/publications/novak18monte.pdf)</sup>。方差缩减技术承担了大部分实际负担：重要性采样、双向技术、梅特罗波利斯采样和准[蒙特卡洛采样](https://www.edgepedia.org/zh/monte-carlo-sampling)是标准类别<sup>[17](https://inria.hal.science/hal-01252647v1/file/zwicker15star.pdf)</sup>，而降噪器改变了含噪输出的经济性<sup>[23](https://people.compute.dtu.dk/jerf/papers/daas_lowres.pdf)</sup>。

## References

1. [Monte Carlo Methods for Volumetric Light Transport Simulation (CGF STAR survey)](https://cs.dartmouth.edu/~wjarosz/publications/novak18monte.pdf)
2. [RL-based Stateful Neural Adaptive Sampling and Denoising for Real-Time Path Tracing (NeurIPS 2023)](https://papers.nips.cc/paper_files/paper/2023/file/d1422213c9f2bdd5178b77d166fba86a-Paper-Conference.pdf)
3. [James T. Kajiya (1986). The rendering equation. ACM SIGGRAPH Computer Graphics.](https://doi.org/10.1145/15886.15902)
4. [Physically Based Rendering, 3rd ed., Path Tracing](https://www.pbr-book.org/3ed-2018/Light_Transport_I_Surface_Reflection/Path_Tracing)
5. [Global Illumination & Path Tracing (UC Berkeley CS184 lecture)](https://cs184.eecs.berkeley.edu/public/sp22/lectures/lec-13-global-illumination-and-path-tra/lec-13-global-illumination-and-path-tra.pdf)
6. [Path Tracing in Production (SIGGRAPH 2019 course, Part 1, Weta Digital)](https://jo.dreggn.org/path-tracing-in-production/2019/ptp-part1.pdf)
7. [Monte Carlo Ray Tracing (CMU 15-462/662 lecture slides)](http://15462.courses.cs.cmu.edu/spring2019content/lectures/18_montecarlo/18_montecarlo_slides.pdf)
8. [Physically Based Rendering, 4th ed., Path Tracing](https://pbr-book.org/4ed/Light_Transport_I_Surface_Reflection/Path_Tracing)
9. [Rendering Equation and Path Tracing (CMU 15-468, Spring 2024)](http://graphics.cs.cmu.edu/courses/15-468/2024_spring/lectures/lecture_11.pdf)
10. [Light Transport Simulation and Realistic Rendering (generations of methods)](https://ceur-ws.org/Vol-3027/paper1.pdf)
11. [The Reference Path Tracer (Ray Tracing Gems II, Chapter 14)](https://developer.download.nvidia.com//ray-tracing-gems/rtg2-chapter14-preprint.pdf)
12. [Robust Monte Carlo Methods for Light Transport Simulation (Eric Veach PhD dissertation)](https://graphics.stanford.edu/papers/veach_thesis/thesis-bw.pdf)
13. [The Path to Path-Traced Movies (Christensen & Jarosz survey)](https://cs.dartmouth.edu/~wjarosz/publications/christensen16path.pdf)
14. [Eric Veach, Leonidas Guibas (1995). Bidirectional Estimators for Light Transport. .](https://doi.org/10.1007/978-3-642-87825-1_11)
15. [Metropolis Light Transport (Veach & Guibas, SIGGRAPH 97 Proceedings)](https://graphics.stanford.edu/papers/metro/)
16. [Toshiya Hachisuka, Shinji Ogaki, Henrik Wann Jensen (2008). Progressive photon mapping. ACM Transactions on Graphics.](https://doi.org/10.1145/1409060.1409083)
17. [Recent Advances in Adaptive Sampling and Reconstruction for Monte Carlo Rendering (STAR report)](https://inria.hal.science/hal-01252647v1/file/zwicker15star.pdf)
18. [Benedikt Bitterli and colleagues (2020). Spatiotemporal reservoir resampling for real-time ray tracing with dynamic direct lighting. ACM Transactions on Graphics.](https://doi.org/10.1145/3386569.3392481)
19. [Daqi Lin and colleagues (2022). Generalized resampled importance sampling. ACM Transactions on Graphics.](https://doi.org/10.1145/3528223.3530158)
20. [CSE 168 Lecture 7: Monte Carlo Path Tracing (UCSD, Ravi Ramamoorthi)](https://cseweb.ucsd.edu/~viscomp/classes/cse168/sp24/lectures/168-lecture7.pdf)
21. [Ray Tracing chapter (KAIST, physically-based rendering textbook)](https://sgvr.kaist.ac.kr/~sungeui/render/pbr/ray.pdf)
22. [Selectively Metropolised Monte Carlo light transport simulation (SIGGRAPH 2019)](https://benedikt-bitterli.me/smlt/bitterli19selectively.pdf)
23. [Denoising-Aware Adaptive Sampling for Monte Carlo Ray Tracing](https://people.compute.dtu.dk/jerf/papers/daas_lowres.pdf)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Oct 15, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods › Numerical, string, and geometric algorithms › Numerical methods and approximation

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/monte-carlo-ray-tracing

English original: https://www.edgepedia.org/monte-carlo-ray-tracing
