NeRFix: fixing subtle mistakes in the quadrature of the NeRF volumetric integral

Luca Savant Aira, Diego Valsesia, Enrico MagliNeurIPS 2026

TL;DR

For years, a couple of quiet calculus bugs have been hiding in plain sight inside the core rendering math of Neural Radiance Fields (NeRFs)—including both the original 2020 paper and the widely used NeRFStudio framework. Because neural networks are famously good at absorbing human error during training, nobody noticed that these integrators fail basic convergence tests. The authors uncover these numerical mismatches and introduce "computationally free" one-line fixes that restore proper mathematical convergence and give rendered image quality a slight, consistent boost.

What Problem Does This Paper Address?

To render a pixel in a NeRF, you shoot a virtual ray into a 3D scene and add up how much light is emitted and absorbed along that path. Mathematically, this is a continuous volumetric integral. Since computers can't compute continuous integrals directly, we chop the ray into $K$ discrete segments ("cells"), sample the neural network inside each cell for color and density, and approximate the integral—a classic technique called numerical quadrature.

Deep learning practitioners tend to view this rendering step simply as a differentiable layer to backpropagate through, rather than a classical scientific computing problem. As a result, no one formally checked the convergence order of NeRF's quadrature rules (how fast the rendering error shrinks as you add more samples $K$). When the authors put the original NeRF paper and the popular NeRFStudio codebase under a numerical microscope, they found subtle mathematical inconsistencies in both that degrade accuracy—or prevent convergence to the true integral altogether.

Methods

First, the authors prove a generic a priori error bound showing that a NeRF's overall pixel rendering error is directly controlled by the error of the quadrature rule used to estimate optical depths in each cell. Better local integration directly guarantees better pixel rendering.

Next, keeping standard MLP architectures, losses, and sampling budgets completely untouched, they diagnose and surgically repair two famous implementations:

  • The Original NeRF Fix (NeRFix): Standard NeRF divides a ray into equal physical intervals $[t_{k-1}, t_k]$ and picks one random sample $\xi_k$ inside each. However, to weight the density at $\xi_k$, the formula multiplies by the distance to the next random sample ($\xi_{k+1} - \xi_k$) instead of the width of the physical cell it came from ($t_k - t_{k-1}$). Worse, the final point $\xi_{K+1}$ doesn't exist—so the official code hardcodes $\xi_{K+1} = 10^{10}$! The fix: simply multiply each sampled density by its true physical cell width, $t_k - t_{k-1}$, turning it into a proper Monte Carlo estimator.
Figure 1: Original NeRF: numerical inconsistency and minimum fix. The top row shows the optical- depth approximation used in the original formulation and its corrected version. The problematic term is the interval length: the original rule uses the distance between adjacent random samples, ξk+1 −ξk, whereas the fix uses the width of the physical cell, tk −tk−1. Moreover, the term ξK+1 is not defined. The bottom row illustrates the geometry on the full domain [xn, xf], partitioned into equispaced cells with one random sample per cell.
  • The NeRFStudio Fix: NeRFStudio's SpacedSampler avoids the undefined endpoint by using a midpoint rule between $K$ random samples, yielding $K-1$ intervals. However, this truncates the ray: it integrates over $[\xi_1, \xi_K]$ instead of the full ray $[x_n, x_f]$, completely ignoring scene content in the two outer end-pieces. The fix: pin the first and last points directly to the ray boundaries ($\xi_1 := x_n$ and $\xi_K := x_f$).
Figure 2: NeRFStudio: numerical inconsistency and minimum fix. The top row shows the midpoint- based optical-depth approximation together with the endpoint correction used in the fixed version. The local midpoint rule is unchanged; the fix consists in forcing the random chain to span the full domain by setting ξ1 = xn and ξK = xf. The bottom row shows the geometry: the original construction covers only the truncated interval [ξ1, ξK], leaving the two endpoint pieces uncovered, whereas the fixed version restores the full domain [xn, xf].

Neither fix requires extra MLP queries, parameters, or compute time.

Datasets

  • Synthetic 1D Sanity Check: A newly formulated closed-form, constant-color analytical test ray (with density $\rho(x) = \cos(\frac{\pi}{2}x)$) where the exact mathematical integral is known, isolating discretization error from neural network training.
  • Standard 3D Benchmarks: Full end-to-end NeRF training is evaluated on Blender, DeepVoxels, and LLFF, using the exact train/test splits from the original NeRF paper.

Key Insights and Ideas

  • The 1e10 hack breaks convergence: Because the official NeRF code sets the missing $\xi_{K+1}$ sample to $10^{10}$, on an analytical constant-color scene it never converges to the true solution, no matter how many samples you throw at it. Even if you patch $\xi_{K+1}$ cleanly, mixing random samples with sample-to-sample widths acts like a clumsy left-rectangle rule, capping root-mean-square (RMS) convergence at order $1$.
  • Training masks bad math: Why did NeRFs look so good for years with broken integrators? Optimization dynamics partially absorb the systematic numerical bias into the learned MLP weights. The network learns to compensate, hiding the bug while quietly leaving accuracy on the table.
  • Free test-time upgrades: Understanding the quadrature properly unlocks a neat trick: once a NeRF is trained, you can swap random cell samples for physical cell midpoints at test time, eliminating sampling noise and jumping straight to $2\text{nd}$-order deterministic accuracy.

Key Results

On the synthetic 1D test problem, empirical log–log error slopes match theoretical predictions:

  • Original NeRF ($\xi_{K+1} = 10^{10}$) fails to converge entirely (flat error).
  • Patched Original NeRF ($\xi_{K+1} = 0$) and baseline NeRFStudio crawl along at first-order convergence (slopes of $-0.947$ and $-0.982$, where $\propto K^{-1}$ is expected).
  • NeRFix recovers proper $1.5$-order Monte Carlo convergence (slope $-1.498$), while NeRFStudio-Fix restores $2\text{nd}$-order midpoint convergence (slope $-1.987$), achieving orders-of-magnitude lower error at practical sample counts.
Figure 3: Synthetic convergence on the test problem, shown as a log–log plot of average absolute error versus the number of samples K. The original NeRF without fixing the ξK+1 mistake does not converge. The NeRF method obtained by setting it to zero, and the NeRFStudio discretizations exhibit approximately first-order behavior, with fitted slopes −0.947 and −0.982, respectively. The proposed fixes recover the higher orders predicted by the theory, with fitted slopes −1.498 for NeRFix and −1.987 for NeRFStudio-Fix. Dashed lines indicate the reference rates K−1, K−3

In full 3D NeRF training (averaged across 10 runs per scene), applying NeRFix improves test-set PSNR across all benchmarks with zero overhead: +0.15 dB on Blender ($31.93 \rightarrow 32.08$), +0.19 dB on DeepVoxels ($41.10 \rightarrow 41.28$), and +0.02 dB on LLFF ($25.44 \rightarrow 25.45$), averaging +0.12 dB PSNR and +0.0005 SSIM overall.

Limitations and Future Work

  • Isolated scope: The theoretical analysis assumes known, accurate fields and interval-constant color; it doesn't model how imperfect MLPs or gradient descent interact with quadrature errors during early training.
  • Modest empirical gains: An average $+0.12$ dB boost is small (though welcome, given it costs literally nothing), and experiments were limited to vanilla NeRF on three classic datasets rather than testing every modern NeRFStudio variant.
  • Future extensions: Because NeRFix focuses on the integration rule over standard piecewise-constant cells, it is orthogonal to—and could be used to verify—higher-order representations like piecewise-linear density models (e.g., PL-NeRF).

Summary updated

Abstract

Neural Radiance Fields (NeRFs) are popular models using MLPs for continuous volumetric representations, which render novel views by means of numerical quadrature of the volumetric integral. Despite the widespread usage of NeRFs, we report subtle mistakes in their quadrature rule which have gone unnoticed for many years. In particular, we highlight mistakes present in both the original NeRF paper and its implementation as well as in the mainstream NeRFStudio implementation. We provide a theoretical analysis of rendering error bounds for NeRF and we use it to show suboptimal convergence rates in the presence of the aforementioned mistakes. We introduce minimal fixes that recover the expected convergence orders with no complexity overhead. Finally, while fixing the quadrature scheme is mostly a matter of theoretical correctness, we also provide experimental evidence that modest improvements in image quality are achieved on standard benchmarks.
BibTeX
@inproceedings{aira2026nerfix,
  author = {Luca Savant Aira and Diego Valsesia and Enrico Magli},
  title = {{NeRFix: fixing subtle mistakes in the quadrature of the NeRF volumetric integral}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=KQfFjq87GI},
}
Figure