NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
Positional encoding, differentiable volume rendering, and hierarchical ray sampling.
12 页原创中英双语数学推导与工程映射深读手册
-
原文标题:NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
-
Authors: Ben Mildenhall; Pratul P. Srinivasan; Matthew Tancik; Jonathan T. Barron; Ravi Ramamoorthi; Ren Ng
-
Version: arXiv:2003.08934v2 (2020-08-03); ECCV 2020
-
License: arXiv non-exclusive license to distribute; https://arxiv.org/licenses/nonexclusive-distrib/1.0/
-
Edition: 2026-11-25. 以下 Original / 中文为原创双语分析,不是逐段翻译或原文摘录。
章节导航
01 / 场景函数是表示,不是几何真值
“5D”指三维位置加二维方向自由度。实现常用三维单位向量表示方向,但它被限制在球面上。密度只依赖位置;颜色可依赖方向,因此同一个空间点可以在不同视角显现高光,同时不必为高光移动几何。若密度也随方向自由变化,多视图可各自编造遮挡结构,约束会更弱。
本册底本为 ECCV 2020 的 arXiv:2003.08934v2,2020-08-03,25 页。作者为 Ben Mildenhall、Pratul P. Srinivasan、Matthew Tancik、Jonathan T. Barron、Ravi Ramamoorthi、Ren Ng。arXiv 条目为默认非独占分发许可;本册中英段落均为原创分析和推导,完整原文另附,页码指固定版本。
输出新视图逼真并不自动证明表面深度正确。颜色、密度、曝光和相机误差可能相互补偿;工程上必须先决定消费者需要的是“看起来像”,还是米制障碍边界、粒子位置或可微观测模型。
Fθ(x,d) = (σ(x), c(x,d)); x ∈ ℝ³, d ∈ S² observed image ≈ ray integral of the same static field
| 接口 | 输入 | 输出 / 约束 |
|---|---|---|
| 训练 | RGB、内参、位姿、近远界 | 每场景优化权重 |
| 渲染 | 新相机射线 | RGB 与可导中间量 |
| 米制使用 | 标定尺度、独立几何验证 | 不能仅凭 PSNR 接受 |
The five-dimensional description counts two degrees of freedom for a viewing direction. Keeping density independent of direction discourages each view from inventing a different occluder, while the color branch explains non-Lambertian appearance.
This companion uses the fixed 25-page arXiv v2 and develops original bilingual analysis under the entry's non-exclusive distribution license. Rendering quality, geometric accuracy and metric safety are separate acceptance targets; the consumer determines the additional measurements required.
02 / 先统一射线、尺度与光学长度
从像素齐次坐标 q=(u,v,1) 经内参逆矩阵得到相机系方向,再用相机到世界旋转变换。符号约定必须配套:计算机视觉常用 +z 朝前,原作 NDC 附录采用 -z 朝前。只抄一个轴翻转而不更改外参、近面和深度定义,会产生数值看似收敛、实际镜像或倒置的场景。
尺度变换揭示一个重要自由度。把位置、相机平移和距离一起乘 s,同时令新密度等于旧密度除 s,沿射线的光学厚度和颜色积分不变。仅凭这些 RGB,并不能把重建的任意长度单位变成米;应加入已知基线、标尺或其他米制观测。
原作把合成场景缩放到边长 2 的立方体,并为前向真实场景采用 NDC。工程记录应保存 world-to-normalized 变换,而不是只保存最终权重;否则后续点云距离、速度和碰撞半径会丢失单位语义。
dcam = K⁻¹q; dworld = Rcam→world dcam / ‖dcam‖ Δℓ = ‖d‖ Δt; α = 1 − exp(−σ Δℓ) x′ = sx, σ′(x′) = σ(x′/s)/s
| 变更 | 错误做法 | 正确配套 |
|---|---|---|
| 方向归一化 | 保留旧 t 不管单位 | 同步步长及近远界 |
| 场景缩放 | σ 数值照搬 | 维持 σΔℓ 不变 |
| 相机坐标 | 只翻转图像 | 同改射线与外参 |
A consistent camera convention includes the forward axis, rotation direction, camera center and near plane. The original NDC derivation looks down negative z.
There is a scale gauge: scaling geometry and translations by s while dividing density by s preserves optical thickness. A metric baseline or reference object fixes this freedom. Preserve the normalization transform, especially when geometry drives velocities or robot clearance.
03 / 连续体渲染来自生存概率
在 t 附近终止的概率密度是 T(t)σ(t),乘该点沿观察方向的颜色并积分,便得到前景贡献。如果射线穿过全部体积仍未终止,剩余概率 T(tf) 应乘背景颜色。有限近远边界并不保证前景权重之和等于 1;漏掉剩余项会把透明区域误当成黑色。
对常密度、常颜色的薄层可以精确积分:厚度 L 的透射率为 exp(−σL),层颜色权重为 1−exp(−σL)。因此 α 不是任意颜色混合旋钮,而是终止率对区间长度的积分结果。改变采样数时,应保持同一连续 σ 的光学厚度,而不是把单点 α 当成不变属性。
这也是把 NeRF 当成实验观测算子的入口。必须先判断实验相机是否满足吸收—发射模型:有折射、强散射、饱和或强背景遮挡时,标准体渲染式需要改写,不能用更大 MLP 来替代错误的光学机制。
T′(t) = −σ(r(t))T(t), T(tn)=1 T(t) = exp(−∫[tn,t] σ(r(s)) ds) C = ∫[tn,tf] T(t)σ(r(t))c(r(t),d) dt + T(tf)cbg
| 常密度例 | 设定 | 解析结果 |
|---|---|---|
| 光学厚度 | σ=2 m⁻¹, L=0.5 m | τ=1 |
| 透射 | T=exp(−1) | 0.367879 |
| 前景占比 | 1−T | 0.632121 |
The foreground integral generally has less than unit mass. Add surviving mass times background color. For a constant slab, the exact result makes physical thickness explicit.
This derivation separates the latent field from observation physics. Refraction, multiple scattering, clipping and fluorescent emission may require a different forward operator. A more expressive neural field cannot repair a systematically wrong image-formation equation.
04 / 离散合成:权重、背景与可复算例
取两个区间,光学厚度分别为 ln2、ln4,颜色分别为红、蓝,背景为白。第一层权重 1/2,第二层权重 (1/2)(3/4)=3/8,剩余背景权重 1/8,最终 RGB 为 (0.625,0.125,0.5)。这里每个数都由解析合成得到,不是论文实验成绩。
在透明区,小 τ 下直接计算 1−exp(−τ) 会产生消去误差,数值上可用 −expm1(−τ)。很多实现给连乘加微小量避免梯度异常,但它会让严格的质量恒等式变为近似;应记录容差,不能既加修正又要求机器精度下的完全等式。
最后一个采样点的区间长度、远界和背景必须联合定义。把末段设为极大长度等价于强制剩余射线最终终止,并不是适合所有透明实验场景的普适边界条件。
αi = −expm1(−σiδi); Ti = ∏j<i wi = Tiαi; Tbg = ∏j≤N ∑ wi + Tbg = 1; C = ∑ wici + Tbg cbg

The two-slab analytical example yields one half red, three eighths blue and one eighth white background: RGB (0.625, 0.125, 0.5). These are implementation checks, not empirical reconstruction metrics.
Use a stable exponential difference for small optical thickness. Define the final interval and background together: an enormous terminal interval forces an interaction and is inappropriate for genuinely transparent domains. Numerical stabilizers should have explicit tolerances.
原创算例:精确权重 0.5、0.375、0.125;不是原作数据。
05 / 可微不等于可识别:遮挡与密度—颜色耦合
取只有一层、黑背景的情形,像素为 C=αc。一个观测只约束乘积:α=0.5,c=0.8 和 α=0.8,c=0.5 都给出 C=0.4。额外视角、密度方向独立、网络先验会削弱这类自由度,却不能把任何视角配置都变成唯一的三维反演。
密度峰值位置、期望深度和真实表面交点也不是同一对象。期望深度是多个终止位置的加权平均;双峰体积可能把均值放到没有物体的空隙。把权重方差压小只能让沿射线更集中,如果集中到错误平面,几何仍然错。
因此几何验收应增加标定靶、深度或已知边界,并分别报告可见表面误差、遮挡区域完整度和外推视角失效。PSNR 是颜色重建指标,无法单独给出毫米级安全边界。
∂C/∂ci = wi ∂C/∂σi = Ti δi exp(−σiδi) (ci − Ci+1) D = (∑ witi)/(∑ wi); V = (∑ wi(ti−D)²)/(∑ wi)
| 指标 | 说明 | 反例 |
|---|---|---|
| 颜色误差小 | 投影吻合 | 错误深度配正确颜色 |
| 深度方差小 | 单射线集中 | 整层集中在错位置 |
| 几何误差小 | 独立坐标吻合 | 仍需检查不可见覆盖 |
A black-background slab shows opacity-color ambiguity: their product can remain fixed. Multiple views and a shared field reduce ambiguity without guaranteeing identification for every capture geometry.
Expected depth can lie between surfaces. Reducing ray-depth variance establishes concentration, not correctness. Validate visible-surface error and coverage independently rather than converting a photometric score into a clearance guarantee.
06 / 网络与位置编码:高频能力有采样条件
位置编码把每个标量映射到多频率正弦与余弦。原文位置采用 L=10,方向 L=4;仅计三角函数,三维位置得到 60 通道,三维方向得到 24 通道。某些代码还拼接原始坐标,维数会变成 63 和 27;讨论论文图 7 与实际实现时要明确是否 include_input。
频率增大意味着网络容易表达更快空间变化,但不意味着相机提供了相应信息。如果采样间隔太大、图像模糊或视角不足,极高频表示可能拟合混叠、曝光变化或相机误差。原作 L=15 的消融没有超越 L=10,正说明表示容量不是越多越好。
用于流体或粒子时,应以最小可观测结构尺度决定编码带宽:粒子 PSF、像素标定与运动曝光共同决定有效分辨率。把涡量细节画得很锐利,仍需要独立观测证明它不是网络先验生成的纹理。
γL(p) = [sin(2ᵏπp), cos(2ᵏπp)] for k=0,…,L−1 dim γ10(x,y,z) = 3×2×10 = 60 dim γ4(dx,dy,dz) = 24
| 空间频带 L | 原作合成集 PSNR | 来源 |
|---|---|---|
| 5 | 30.59 dB | p.14 Table 2 |
| 10 | 31.01 dB | p.14 Table 2 |
| 15 | 30.81 dB | p.14 Table 2 |
Ten spatial bands and four direction bands produce 60 and 24 sinusoidal features. Appending raw coordinates changes those dimensions, so distinguish that implementation option from the illustrated convention.
Representation bandwidth does not create measurement bandwidth. Blur, sparse views and insufficient rays can turn additional frequencies into aliasing or error compensation. Choose bandwidth compatible with the observed PSF and sampling, then validate fine structure independently.
07 / 分层采样不是免费减少所有查询
原作每条射线粗网络 64 次、细网络 64+128=192 次,总计 256 次网络查询。不能把新增的 128 个样本误写成总成本。4096 条射线的一批需要 1,048,576 次场查询;800×800 图像需要 163,840,000 次。这是算术计数,不包含不同网络成本、批处理、内存传输和硬件利用率。
归一化时若所有粗权重接近 0,PDF 会病态。实现通常加入小正数作为均匀探索底座,并处理 CDF 的重复值。训练阶段如果把粗层采样位置到权重的梯度截断,应保持这一决定和损失契约一致;否则会以为正在优化采样策略,实际只是在更新颜色网络。
分层采样对被粗阶段完全漏掉的细物体无能为力。必须保留探索覆盖、检查粗细结果差异;不能仅因为细网络给出的射线分布很尖,就推断远处细杆或稀疏粒子已被可靠找到。
pi = (wi+ε)/∑j(wj+ε); Fk = ∑[i≤k]pi queries/ray = Nc + (Nc+Nf) = 2Nc+Nf Nc=64, Nf=128 ⇒ 256 queries/ray
coarse_t = stratified(near, far, 64)
coarse_rgb, weight = render(coarse_t)
extra_t = inverse_cdf(weight, count=128)
fine_t = sort(concat(coarse_t, extra_t))
fine_rgb = render_fine(fine_t) # 192 locations
The original configuration costs 64 coarse plus 192 fine queries per ray, not 128. A 4096-ray batch makes 1,048,576 queries; an 800-by-800 image makes 163,840,000. These counts are not CPU timings.
Nearly empty rays need a stable probability floor and repeated-CDF handling. Coarse misses can persist into fine sampling, particularly for thin geometry. Retain exploration and inspect coarse-versus-fine discrepancies rather than interpreting sharp distributions as complete coverage.
08 / 优化目标与最小工程实现
以归一化颜色 [0,1] 为例,MSE=10⁻³ 对应 PSNR=30 dB;若数据在 [0,255],PSNR 的峰值必须同步取 255。不同颜色空间、背景合成、mask、图像缩放以及平均方式都会改变分数。对逐图 PSNR 求平均,与先合并所有像素的 MSE 再换算,并不一般相等。
训练数据必须带固定内参、位姿和场景边界。真实场景原作借助 COLMAP,说明 NeRF 并没有在这个版本里取消相机估计。保存数据分割和规范化元数据,测试图像只用于评价;从测试视角微调后再报告原先“留出视角”的成绩会改变任务。
本册只做 CPU 解析验算和排版,不运行原作训练。原作报告每场景约 100–300k 次迭代、单 V100 约 1–2 天;这些是历史配置的成本,不是本机基准,也不是现代实现的统一速度承诺。
L = ∑r (‖Cc(r)−Cobs(r)‖² + ‖Cf(r)−Cobs(r)‖²) PSNR = 10 log10(peak²/MSE) peak=1, MSE=0.001 ⇒ PSNR=30 dB
| 检查 | 可观察失败 | 修正位置 |
|---|---|---|
| 射线/单位 | 透明度随像素漂移 | 坐标与区间长度 |
| 背景处理 | 透明边缘持续黑边 | 合成边界条件 |
| 分割/评价 | 测试泄漏或不可比 PSNR | 数据与评价脚本 |
For unit-peak intensities, MSE 0.001 corresponds to 30 dB PSNR. Color space, masks, resizing, backgrounds and aggregation belong to the metric definition. Average per-image PSNR generally differs from converting global pixel MSE.
The original real-scene pipeline relies on estimated cameras. Store them, normalization and split. Historical V100 training costs describe the paper's implementation. This companion performs analytical checks and CPU document production, not model training or hardware benchmarking.
09 / 原作证据:优势、例外与消融要一起读
在 realistic synthetic 集合,完整模型 PSNR=31.01 dB,去掉位置编码为 28.77、去掉视角依赖为 27.66、去掉分层采样为 30.06。它们分别对应下降 2.24、3.35 和 0.95 dB;数值只适用于此数据和该消融协议,并非对任何场景都可直接相加的独立收益。
25 视图时 PSNR=27.78,50 视图为 29.79,100 视图为 31.01。更少视角会削弱约束,但“多少视图够”还依赖覆盖、基线、物体反射和遮挡,不是只看数量。相邻帧很多却没有有效视差,可能仍然无法约束深度。
文中约 5 MB 权重描述的是场景存储,不等于训练峰值显存或渲染缓存。渲染复杂度、训练时间和存储体积属于不同资源轴;做具身系统选型时要分开比较。
ΔPSNR(no PE) = 31.01−28.77 = 2.24 dB ΔPSNR(no VD) = 3.35 dB; ΔPSNR(no H) = 0.95 dB
| 集合 / Metric | NeRF | LLFF |
|---|---|---|
| 真实前向 PSNR ↑ | 26.50 | 24.13 |
| 真实前向 SSIM ↑ | 0.811 | 0.798 |
| 真实前向 LPIPS ↓ | 0.250 | 0.212 |
| 真实合成 PSNR ↑ | 31.01 | 24.88 |
The synthetic ablation supports encoding, view-dependent appearance and hierarchical sampling under a fixed protocol. Their removal costs 2.24, 3.35 and 0.95 dB respectively; these are conditional, not additive universal benefits.
View count is a proxy for geometric coverage. Repeated neighboring views may add little depth information. Compact weights also do not imply low training memory or cheap rendering. Separate fidelity, calibration needs, storage and latency.
10 / NDC:把无限深度压进有限区间
用负 z 朝前约定,平移后的起点记作 o,令 A=−2f/W、B=−2f/H。变换后原点为 (A ox/oz, B oy/oz, 1+2n/oz),方向为 (A(dx/dz−ox/oz), B(dy/dz−oy/oz), −2n/oz)。新参数 t′=tdz/(oz+tdz),当原距离趋于无穷时 t′趋于 1。
对沿相机中心轴、n=1 的射线,原点在 z=−1,变换后 z′从 −1 向 1 变化。取新参数 0、0.5、0.9,对应米制前向深度 1、2、10。可见均匀 NDC 参数采样本质上偏重近处,且不能把 NDC 的 z′直接当成米制 Z。
若将该场输入三维点云策略或流体积分器,须先做逆变换并恢复规范化尺度。尤其是速度导数、体积元素和散度,在非线性坐标变化下需要雅可比;在 NDC 空间“无散”不等于物理空间不可压缩。
origin shift: tn = −(n+oz)/dz; o ← o+tn d t′ = tdz/(oz+tdz) central ray: physical depth Z = n/(1−t′)
| t′ | NDC z′=−1+2t′ | Z, n=1 |
|---|---|---|
| 0 | −1 | 1 |
| 0.5 | 0 | 2 |
| 0.9 | 0.8 | 10 |
For a central ray with unit near depth, transformed parameters 0, 0.5 and 0.9 correspond to physical depths 1, 2 and 10. A uniform transformed step is not a uniform metric step.
Nonlinear coordinates transform derivatives and volume elements. Zero divergence in arbitrary rendering coordinates need not imply mass conservation in the laboratory. Restore metric geometry and Jacobians before physical integration or robot planning.
11 / 迁移到事件与流体:先写观测,再写物理
实验流体中的粒子发光、激光片照明和成像 PSF 也与吸收型 NeRF 不完全相同。稀疏发光粒子可先用发射叠加与 PSF 卷积近似,而不是硬套不透明表面。照明厚度、粒子进出光片和遮挡改变可见概率,需要同动力学分开建模。
物理速度 u 与辐射密度 σ 是不同物理量。不可压缩流满足速度散度为零,而亮度或粒子浓度在理想条件下满足输运方程。把 NeRF 的密度正则化成“无散密度”没有明确数学含义;正确做法是另设速度场,让它输运标量,并在实验世界坐标中约束散度和边界通量。
最优传输可为稀疏时刻的粒子分布提供软关联,但无标签质量匹配不能确定粒子身份。应把直接追踪支持区、物理插值区与完全无观测区分别输出;物理先验填出的回流结构应通过额外视角、主动照明或独立流量测试。
event: log I(q,t₂)−log I(q,t₁) ≈ pC fluid: ∂tρ + ∇·(ρu) = s; incompressible: ∇·u = 0 I(q,t) ≈ PSF * ∫ illumination(x)ρ(x,t) dℓ
| 对象 | 可约束量 | 关键缺失 |
|---|---|---|
| 事件流 | 亮度变化及时间 | 绝对亮度、阈值漂移 |
| 粒子图像 | 投影发光分布 | 遮挡、身份、离片 |
| 速度先验 | 连续性与边界条件 | 无观测区唯一性 |
Radiance density and fluid velocity are distinct. Incompressibility constrains velocity divergence; an advected concentration obeys transport under additional assumptions. Define a separate velocity field in laboratory coordinates.
Optimal transport associates distributions without establishing particle identity. Distinguish direct tracking support from prior-driven interpolation, then add observations that discriminate competing hidden flows. These are engineering hypotheses, not NeRF experimental results.
12 / 从读论文到可用接口:验收路线
最小 CPU 复算包含:常密度薄层解析解、两层颜色与背景权重守恒、密度梯度有限差分、场景缩放不变性和 NDC 逆深度例。它们分别检查观测算子、离散化、导数、单位和坐标契约。通过这些检查不能替代训练收敛或真实场景测量,但能迅速排除常见实现错误。
研究上最有价值的实验不是只追逐 PSNR,而是构造相近图像却不同几何的候选,检查额外测量能否分辨它们;再比较纯像素、几何监督与物理约束在可观测区和盲区的影响。对于流体,报告速度误差、散度残差、通量与不确定性;对于具身任务,报告米制净空和实际成功率。
本册公式、数值例与工程表均为原创,原论文实验值在相应页内明确定位。全文 25 页均保留逐页文本和版面块记录;正文、参考文献及补充材料可回到英文 PDF 查阅。完整逐段翻译不属于这个许可分支的交付。
geometry interface = frame + scale + uncertainty + visibility acceptance = observation fit + independent task-space evidence
| 术语 | 固定中文 | 含义 |
|---|---|---|
| radiance field | 辐射场 | 位置/方向到密度与颜色 |
| transmittance | 透射率 | 射线未终止概率 |
| opacity | 不透明度 | 区间终止概率 |
| gauge freedom | 规范自由度 | 不改变观测的参数变化 |
| hierarchical sampling | 分层采样 | 粗权重引导细查询 |
The CPU checks test slabs, compositing mass, density derivatives, scale invariance and NDC inversion. They establish implementation premises, not trained-reconstruction accuracy.
A discriminating study constructs fields explaining similar images and asks which measurement separates them. Report geometry or velocity error, physical residuals and uncertainty alongside PSNR. Derivations and examples are original; source experiments are located in the fixed PDF. Every source page retains extraction metadata.
Show Translation & Notation Audit Notes
- 原文:NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
- 作者:Ben Mildenhall; Pratul P. Srinivasan; Matthew Tancik; Jonathan T. Barron; Ravi Ramamoorthi; Ren Ng
- 固定底本:arXiv:2003.08934v2,2020-08-03,ECCV 2020。官方入口:https://arxiv.org/abs/2003.08934v2
- 本地英文 PDF 共 25 页;全部源页逐页提取保存在 work/source_pages.json,含正文、参考文献和补充材料,原文未删改。
- 官方 abs 页 view license 为 arXiv non-exclusive-distrib/1.0;证据在 work/arxiv_abs.html 与 work/license.html。论文许可与代码、数据、模型权重许可分开判断。
- 依本任务许可分支交付 12 页原创中英双语数学推导与工程映射手册,不是完整逐段译本。paper.md 中 Original 为本册原创英文,与中文共同解释同一主题,不是原文摘录。
- A01–A12 逐节指回固定原文页;source_map.json 还保存全部源页版面块清单。公式使用排版字符,无 LaTeX/BibTeX 宏。
- 新图为原创 CPU 绘制 PNG;原论文图表在英文 PDF 对应页查看。原作指标附页、表与条件,教学算例和迁移设想另行标明。
- 所有新数值仅为解析/CPU 单元测试;未下载模型、未推理、未训练,未声称本机任务性能。
验证
详见 verification.json 与 work/math_checks.json:Edge 无头关闭 GPU 印刷;PyMuPDF 检查逐页文本、乱码、裸宏、边界并渲染抽页目检。
重建入口
CPU 构建源为 21_Mildenhall_NeRF神经辐射场/中英对照/work/build_handbooks.py(同时含21与22独立内容),相邻 print_handbooks.py 调用本机 Edge,verify_handbooks.py 对照中英全段与 PDF 文本并生成逐页图。排版源 work/handbook.html 为保留的可重印稿,不是 .tmp.html 临时文件。