Search

Search papers and lessons

Mip-NeRF: A Multiscale Representation for Anti-Aliasing Neural Radiance Fields

Jonathan T. Barron, Ben Mildenhall, Matthew Tancik et al. · 2021

Mip-NeRF renders a pixel as a cone instead of a ray and encodes the cone's Gaussian footprint, so one network stays sharp at every scale and is faster and half the size of NeRF.

On this page

  • Colour = topic mix
  • Linear algebra
  • Calculus
  • Probability
  • Discrete math
  • Electromagnetism
  • Electrical engineering
  • ReadReady to readNot yet

TL;DR

Mip-NeRF is a neural scene representation that renders each pixel as a cone of space instead of a single ray. Each piece of the cone is approximated by a Gaussian, and the network receives the average of the positional encoding over that Gaussian, so it learns the scene at every scale at once. On a multiscale benchmark the paper reports 60% lower average error than NeRF, with about 7% faster training and half the parameters.

Builds on: NeRF, Positional Encoding, Volume Rendering, Mipmap · Leads to: faster radiance-field methods such as Instant-NGP and 3D Gaussian Splatting, which keep the goal of rendering at any scale.

Why it mattered

NeRF showed that a small neural network could store a 3D scene and render new views of it with high quality. Its renderings had a flaw that the NeRF benchmark did not expose: when the training photographs were taken at different distances, close-up views came out blurred and distant views came out aliased. The Blender benchmark used by NeRF has every camera at one distance, so this flaw never shows there. The paper's contribution is to fix the flaw without the cost of brute-force supersampling, and to show that the fix also makes the model smaller.

The reason the work matters beyond its own numbers is the change of approach. Mip-NeRF takes the old computer graphics idea of prefiltering and moves it into a neural field. The same question, "what does one pixel really see?", now has an answer that a network can learn from. Later faster representations, including Instant-NGP and 3D Gaussian Splatting, are about speed and quality of rendering, and they keep the requirement that a scene should look right at any distance.

The problem

A NeRF renders a pixel by casting one ray from the camera's centre through the pixel and sampling points along it. Each sample queries a multilayer perceptron, and the colour of the pixel is a weighted sum of the samples. This is a point-sampling strategy, and it has the weakness described in Anti-Aliasing: a single ray through the centre of a pixel reads one spot of the scene, however large the pixel is in world coordinates. If the scene is seen from far away, a pixel covers much detail and one ray misses most of it. If the scene is seen up close, a pixel covers little detail and the network is asked to render a blurred version of its training images.

The standard fix is supersampling: cast several rays per pixel and average them. The paper rejects it for NeRF, because each ray needs hundreds of network evaluations, and so supersampling multiplies an already expensive cost. The question is whether one ray can be replaced by a region that the network can encode directly, at a cost close to one ray.

How it works

The pipeline runs once per pixel. The figure below shows the order of the stages.

flowchart LR
  A[Cone from the camera through the pixel] --> B[Split the cone into intervals]
  B --> C[Fit a Gaussian to each interval]
  C --> D[Integrated positional encoding]
  D --> E[One MLP gives density and colour]
  E --> F[Composite along the cone as in NeRF]
  F --> G[Resample the weights for the next pass]
  G --> E

Here is one interval traced through in one dimension, with two frequencies, to show what the encoding does. The interval is centred at μ=2\mu = 2 and has variance σ2=0.25\sigma^2 = 0.25, so its half-width is about half a unit.

  1. Cast a cone and split it. Mip-NeRF sets a cone from the camera centre through the pixel and chops it into nn pieces between two distances. The cone widens with distance, so later pieces cover more world space. Check: a piece near the camera is narrow, a piece far away is wide.
  2. Fit a Gaussian to the piece. The piece is a frustum, a truncated cone. The paper approximates it with a multivariate Gaussian whose mean sits on the axis of the cone and whose variance grows with the cone's width. Use μ=2\mu = 2 and σ2=0.25\sigma^2 = 0.25 for the one-dimensional instance. Check: a point is most likely near the centre of the Gaussian, so the piece is represented by its middle and its spread.
  3. Take the encoding at the mean. A plain positional encoding of the single point x=2x = 2 with frequencies 11 and 22 gives sin⁡2=0.909\sin 2 = 0.909, cos⁡2=−0.416\cos 2 = -0.416, sin⁡4=−0.757\sin 4 = -0.757, cos⁡4=−0.654\cos 4 = -0.654. Check: these four numbers are the encoding of one point, the thing NeRF uses.
  4. Average the encoding over the Gaussian. Each sine and cosine is multiplied by exp⁡(−12σl2)\exp(-\tfrac{1}{2}\sigma_l^2), where σl2\sigma_l^2 is the variance of that frequency. The first frequency has variance 0.250.25, so its factor is 0.8820.882. The second has variance 4×0.25=14 \times 0.25 = 1, so its factor is 0.6070.607. The result is [0.803,−0.367,−0.459,−0.396][0.803, -0.367, -0.459, -0.396]. Check: the attenuation is stronger at the higher frequency, which is the one that carries fine detail. A wide piece therefore carries less fine detail, and that is the anti-aliasing.
  5. Feed the encoding to one network. The MLP receives the attenuated features for each interval and returns a density and a colour. The same network is used for every scale. Check: a large interval gives small high-frequency values, so the network learns that the content is blurred at that scale.
  6. Composite as NeRF does. The colour of the pixel is the weighted sum of the interval colours, with weights from the densities. The sum is the usual volume rendering. Check: it is the same final step as NeRF, so only the inputs changed.
  7. Resample for detail. The weights from the first pass give a second set of intervals that are denser where the scene has content. The second pass reuses the same network. Check: one network does both passes, so the model has half the parameters of NeRF's two networks.

The key move is in step 4. The network never sees a sharp point. It sees a point blurred by the size of the piece it is looking at, and the blur is computed in closed form, so it costs little.

00.511.5200.20.40.60.81interval standard deviation σattenuation factor
  • frequency 1 (variance σ²)
  • frequency 2 (variance 4σ²)
A wider Gaussian shrinks the high-frequency terms much faster. At σ = 0.5 the second frequency keeps about 0.6 of its value and at σ = 1 it keeps about 0.14.

The math

NeRF's rendering equation, in the paper's notation, is the sum over the samples kk along a ray,

C(r)=∑kTk(1−exp⁡(−τk(tk+1−tk))) ck,Tk=exp⁡(−∑k′<kτk′(tk′+1−tk′))\mathbf{C}(\mathbf{r}) = \sum_{k} T_k \big(1 - \exp(-\tau_k (t_{k+1} - t_k))\big)\, \mathbf{c}_k, \qquad T_k = \exp\Big(-\sum_{k' \lt k} \tau_{k'} (t_{k'+1} - t_{k'})\Big)

Here τk\tau_k is the density at sample kk, ck\mathbf{c}_k is its colour, and TkT_k is the fraction of light that gets through the samples before kk. Mip-NeRF keeps this equation and changes only what the network receives, as the next subsections describe.

Definition: Conical frustum

A pixel's cone starts at the camera centre o\mathbf{o} and runs in the direction d\mathbf{d} through the pixel centre. Its radius at unit distance is r˙\dot r, set to the pixel width scaled by 2/122/\sqrt{12} so that the cone's cross-section matches the pixel's footprint. The frustum between two distances t0t_0 and t1t_1 is the part of the cone in that range.

Step 1 in symbols: the Gaussian

Each frustum is summarised by a midpoint tμ=(t0+t1)/2t_\mu = (t_0 + t_1)/2 and a half-width tδ=(t1−t0)/2t_\delta = (t_1 - t_0)/2. The paper gives closed forms for the spread along the axis, σt2\sigma_t^2, and across it, σr2\sigma_r^2:

μt=tμ+2tμtδ23tμ2+tδ2,σt2=tδ23−4tδ4(12tμ2−tδ2)15(3tμ2+tδ2)2\mu_t = t_\mu + \frac{2 t_\mu t_\delta^2}{3 t_\mu^2 + t_\delta^2}, \qquad \sigma_t^2 = \frac{t_\delta^2}{3} - \frac{4 t_\delta^4 (12 t_\mu^2 - t_\delta^2)}{15 (3 t_\mu^2 + t_\delta^2)^2}

σr2=r˙2(tμ24+5tδ212−4tδ415(3tμ2+tδ2))\sigma_r^2 = \dot r^2 \left(\frac{t_\mu^2}{4} + \frac{5 t_\delta^2}{12} - \frac{4 t_\delta^4}{15 (3 t_\mu^2 + t_\delta^2)}\right)

These are computed in a frame aligned with the cone. The world-space mean and covariance are

μ=o+μtd,Σ=σt2 ddT+σr2(I−ddT∥d∥22)\boldsymbol{\mu} = \mathbf{o} + \mu_t \mathbf{d}, \qquad \boldsymbol{\Sigma} = \sigma_t^2\, \mathbf{d}\mathbf{d}^{\mathsf T} + \sigma_r^2 \Big(\mathbf{I} - \frac{\mathbf{d}\mathbf{d}^{\mathsf T}}{\lVert \mathbf{d} \rVert_2^2}\Big)

The first term stretches along the viewing direction and the second spreads across it. Only the diagonal of Σ\boldsymbol{\Sigma} is needed later, which is what makes the method cheap.

Step 2 in symbols: the encoding

NeRF's positional encoding of a point x\mathbf{x} with LL frequencies is

γ(x)=[sin⁡(20x),cos⁡(20x),…,sin⁡(2L−1x),cos⁡(2L−1x)]\gamma(\mathbf{x}) = \big[\sin(2^0 \mathbf{x}), \cos(2^0 \mathbf{x}), \ldots, \sin(2^{L-1} \mathbf{x}), \cos(2^{L-1} \mathbf{x})\big]

The integrated positional encoding averages γ\gamma over the Gaussian. Because γ\gamma is a sum of sines and cosines of a linear function of x\mathbf{x}, the average of each term has a closed form. For a scalar x∼N(μ,σ2)x \sim \mathcal N(\mu, \sigma^2),

E[sin⁡x]=sin⁡(μ) e−σ2/2,E[cos⁡x]=cos⁡(μ) e−σ2/2\mathbb{E}[\sin x] = \sin(\mu)\, e^{-\sigma^2/2}, \qquad \mathbb{E}[\cos x] = \cos(\mu)\, e^{-\sigma^2/2}

So the integrated encoding is

γ(μ,Σ)=[sin⁡(μ)∘exp⁡ ⁣(−12diag⁡(Σγ))cos⁡(μ)∘exp⁡ ⁣(−12diag⁡(Σγ))]\gamma(\boldsymbol{\mu}, \boldsymbol{\Sigma}) = \begin{bmatrix} \sin(\boldsymbol{\mu}) \circ \exp\!\big(-\tfrac12 \operatorname{diag}(\boldsymbol{\Sigma}_\gamma)\big) \\ \cos(\boldsymbol{\mu}) \circ \exp\!\big(-\tfrac12 \operatorname{diag}(\boldsymbol{\Sigma}_\gamma)\big) \end{bmatrix}

where ∘\circ is element-wise multiplication, and Σγ\boldsymbol{\Sigma}_\gamma is the covariance after the encoding's frequency scaling. The paper shows that only its diagonal is needed:

diag⁡(Σγ)=[diag⁡(Σ),  4diag⁡(Σ),  …,  4L−1diag⁡(Σ)]T\operatorname{diag}(\boldsymbol{\Sigma}_\gamma) = \big[\operatorname{diag}(\boldsymbol{\Sigma}),\; 4\operatorname{diag}(\boldsymbol{\Sigma}),\; \ldots,\; 4^{L-1}\operatorname{diag}(\boldsymbol{\Sigma})\big]^{\mathsf T}

The factor 4l4^l is the square of the frequency 2l2^l, which is why the second frequency of the walkthrough had variance 4×0.25=14 \times 0.25 = 1.

Step 3 in symbols: the rule that makes the attenuation

Read the formula as: each frequency's sine and cosine is attenuated by exp⁡(−12⋅4lσ2)\exp(-\tfrac12 \cdot 4^l \sigma^2). At a given σ\sigma, the factor falls faster for high ll, so fine detail disappears first. That is the same effect as the box and Gaussian filters in Anti-Aliasing, written as a per-feature factor rather than a convolution. The Plot above shows the two factors for the first two frequencies.

Worked examples

Example
1. Tiny: a point interval gives the plain encoding

Take an interval with zero width, so σ=0\sigma = 0, centred at μ=2\mu = 2, with frequencies 11 and 22.

  1. The attenuation factor is exp⁡(−12⋅0)=1\exp(-\tfrac12 \cdot 0) = 1 for both frequencies.
  2. The sines and cosines are sin⁡2=0.909\sin 2 = 0.909, cos⁡2=−0.416\cos 2 = -0.416, sin⁡4=−0.757\sin 4 = -0.757 and cos⁡4=−0.654\cos 4 = -0.654.
  3. The integrated encoding is exactly those four numbers.
  4. Interpretation: a point is the special case of a zero-width interval, so the integrated encoding reduces to NeRF's positional encoding. Nothing is removed when there is nothing to average over.
Example
2. Standard: the blurred interval from the walkthrough

Use μ=2\mu = 2, σ2=0.25\sigma^2 = 0.25, and frequencies 11 and 22, as in How it works.

  1. Frequency 1 has variance 0.250.25, so its factor is exp⁡(−0.125)=0.882\exp(-0.125) = 0.882. Its sine is 0.909×0.882=0.8030.909 \times 0.882 = 0.803, and its cosine is −0.416×0.882=−0.367-0.416 \times 0.882 = -0.367.
  2. Frequency 2 has variance 4×0.25=1.04 \times 0.25 = 1.0, so its factor is exp⁡(−0.5)=0.607\exp(-0.5) = 0.607. Its sine is −0.757×0.607=−0.459-0.757 \times 0.607 = -0.459, and its cosine is −0.654×0.607=−0.396-0.654 \times 0.607 = -0.396.
  3. The integrated encoding is [0.803,−0.367,−0.459,−0.396][0.803, -0.367, -0.459, -0.396].
  4. Interpretation: the low-frequency terms keep most of their value, and the high-frequency terms are pulled toward zero. The network therefore sees less fine structure for this wide interval, which is the right answer for a pixel that covers a lot of world space.
Example
3. Realistic: the paper's benchmark numbers

The paper reports average error over PSNR, SSIM and LPIPS on its multiscale Blender benchmark (Table 1). NeRF scores 0.0288 and Mip-NeRF scores 0.0114. Training time is 3.05 hours for NeRF and 2.84 hours for Mip-NeRF, and the parameter counts are 1,191K and 612K.

  1. Average error reduction: (0.0288−0.0114)/0.0288=0.0174/0.0288≈0.60(0.0288 - 0.0114) / 0.0288 = 0.0174 / 0.0288 \approx 0.60, so 60% lower error, as the paper states.
  2. Training time reduction: (3.05−2.84)/3.05=0.21/3.05≈0.069(3.05 - 2.84) / 3.05 = 0.21 / 3.05 \approx 0.069, so about 7% faster.
  3. Parameter ratio: 612/1191≈0.51612 / 1191 \approx 0.51, so about half the size.
  4. At one eighth of full resolution, the PSNR is 35.602 for Mip-NeRF and 22.533 for NeRF. The gap is 35.602−22.533=13.06935.602 - 22.533 = 13.069 dB.

Interpretation: the largest gain is at the smallest scale, where NeRF's point samples are most wrong, and the cost is lower, not higher. Try it: on the single-scale Blender benchmark (Table 2) the average error falls from 0.0194 to 0.0161. By what percentage does it fall? Answer: (0.0194−0.0161)/0.0194=0.0033/0.0194≈0.17(0.0194 - 0.0161)/0.0194 = 0.0033/0.0194 \approx 0.17, so 17%, which matches the paper's figure. The gain is smaller here, because that benchmark has no scale changes for the method to handle.

Results

Multiscale Blender benchmark (Table 1). The benchmark is the NeRF Blender scenes, box-downsampled by factors of 2, 4 and 8 and mixed into one training set. Mip-NeRF scores an average error of 0.0114, against 0.0288 for NeRF with the Jax implementation. Its PSNR is 32.629 at full resolution and 35.602 at one eighth, while NeRF goes from 31.196 to 22.533. Removing the integrated encoding is a large drop. "w/o IPE" falls back to point-sampled features, with a PSNR of 29.647 at one eighth resolution against 35.602 for the full model, and an average error of 0.0186. The paper says this degrades Mip-NeRF to the level of NeRF with centred pixels, so cone-casting and the integrated encoding are the primary factors. The area loss also contributes substantially.

Single-scale Blender benchmark (Table 2). Mip-NeRF scores an average error of 0.0161, against 0.0194 for NeRF in the same implementation. The paper reports the gain as about 17%, and the gain is most visible on small or thin objects.

Supersampling (Table 3). Supersampled NeRF is the accuracy target. Mip-NeRF nearly matches its accuracy while rendering about 22 times faster, and adding supersampling to Mip-NeRF improves it slightly.

Limits the paper states or implies. The benchmarks are synthetic Blender scenes, where the camera path and lighting are controlled. The multiscale benchmark was built by the authors to probe the failure mode, so its numbers show the effect of the method on that failure, not on every real capture. Mip-NeRF is about 7% faster than NeRF, so the speed gain is small, and the main benefit is accuracy and size. The "single MLP" variant is about 20% slower than Mip-NeRF, which shows that the one-network design is itself a choice that pays off.

Reading guide

  1. Section 1, Introduction. Read Figure 1 first: it contrasts a NeRF ray with a Mip-NeRF cone. Needs NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis and Positional Encoding.
  2. Section 2, Related work. Skim it for the context. Section 2.1 restates NeRF's rendering equation, which needs Volume Rendering.
  3. Section 3.1, Cone tracing and positional encoding. The core of the paper. Needs Fourier Transform for the Fourier-feature view of the encoding, Multivariate Gaussian for the Gaussian, Covariance Matrix for Σ\boldsymbol{\Sigma}, and Integrated Positional Encoding for the result.
  4. Section 3.2, Architecture. The single MLP and the resampling that uses Importance Sampling to place fine samples. The formula for the smoothed weights is the detail to check here.
  5. Section 4, Results. Read Table 1 with the ablation rows, then Table 3. Needs Anti-Aliasing to read the ablation labels.
  6. Supplement. The derivations of the Gaussian moments, and the implementation details that differ from NeRF's.

Check yourself

QuestionRecall: what does Mip-NeRF replace NeRF's ray with, and what is it approximated by?Show answer
A cone cast from the camera centre through the pixel. Each piece of the cone, a conical frustum, is approximated by a multivariate Gaussian with a mean on the cone's axis and a variance that grows with distance.
QuestionCompute: an interval has mean μ=1\mu = 1 and variance σ2=0.5\sigma^2 = 0.5 along one coordinate, and the encoding has frequencies 11 and 22. What is the attenuation factor for each frequency?Show answer
For frequency 1 the variance is 0.50.5, so the factor is exp⁡(−12⋅0.5)=exp⁡(−0.25)≈0.779\exp(-\tfrac12 \cdot 0.5) = \exp(-0.25) \approx 0.779. For frequency 2 the variance is 4×0.5=24 \times 0.5 = 2, so the factor is exp⁡(−12⋅2)=exp⁡(−1)≈0.368\exp(-\tfrac12 \cdot 2) = \exp(-1) \approx 0.368.
QuestionWhy: why does Mip-NeRF need only one MLP where NeRF uses two?Show answer
NeRF's point encoding can represent only one scale, so it needs a coarse network and a fine network. Mip-NeRF's integrated encoding carries the scale of each interval in its own values, so one network can represent the scene at every scale, and the two-network scheme is no longer needed.
QuestionApplied: a camera is pulled back so that the pixel footprint doubles in world size. What happens to the variance of the Gaussian for a fixed interval, and what does the network see?Show answer
The cone's radius at a given distance doubles, so the across-axis variance σr2\sigma_r^2 grows, roughly by a factor of four. The encoding's attenuation factors for high frequencies drop, so the network receives smaller high-frequency features and learns to render a blurrier version of that region. This matches what the image should look like at a larger distance.

Sources

  • Barron, J. T., Mildenhall, B., Tancik, M., Hedman, P., Martin-Brualla, R., Srinivasan, P. P. (2021). Mip-NeRF: A Multiscale Representation for Anti-Aliasing Neural Radiance Fields. arXiv:2103.13415. arxiv.org/abs/2103.13415
  • Mildenhall, B., Srinivasan, P. P., Tancik, M., Barron, J. T., Ramamoorthi, R., Ng, R. (2020). NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis. arXiv:2003.08934. arxiv.org/abs/2003.08934
  • Background: Mipmap (Wikipedia)

Read the full paper

Jonathan T. Barron, Ben Mildenhall, Matthew Tancik et al., 2021. arXiv:2103.13415