TL;DR
NeRF stores a real-world scene inside a small neural network. The network takes a 3D point and a viewing direction and returns a colour and a density, which says how much light the point blocks or emits. It is trained on a few dozen photos taken from known camera positions, and then it can draw the scene from positions that were never photographed. On most metrics of the paper's benchmarks it beat the view-synthesis methods of its time, and it stored a scene in about 5 MB.
Builds on: Volume Rendering, Feedforward Neural Network, Positional Encoding, Pinhole Camera Model, Monte Carlo Method · Leads to: the later neural-rendering and view-synthesis work it inspired (no lesson node yet)
Why it mattered
Before NeRF, scenes were usually stored as meshes, voxel grids or multiplane images. Each trades detail against memory and fits the photos in a different way. NeRF showed that one fully connected network, fitted to the photos by plain gradient descent, could hold fine geometry and view-dependent shine at high resolution. The paper reports 5 MB for its network, against more than 15 GB for the LLFF baseline on one realistic synthetic scene. Because the rendering step is differentiable, the photos alone are the training signal and no 3D labels are needed. The paper has about 1,670 citations on Semantic Scholar, and its formulation of a scene as a learned, ray-integrated function became the base for much of the follow-up work.
The problem
View synthesis asks: given photos of a scene with known camera poses, what would the scene look like from a new camera? The answer needs a representation that can be queried from any direction, at any resolution, at a reasonable memory cost.
Three approaches fell short:
- Voxel grids store one value per cell. A grid of 128 cells per side has 128 cubed, about 2.1 million, cells. Doubling the resolution multiplies the storage by eight, so detail is capped by memory.
- Methods that predict one colour per ray lose the view-dependent shine of real surfaces and blur geometry.
- Plain MLPs fed raw coordinates fit smooth functions but struggle with fine texture and sharp edges. The paper's ablations show this directly.
The paper's answer is a continuous function, represented by an MLP, that is evaluated only where a ray needs it.
How it works
The method takes a set of posed photos and produces a function that can render any view. Here is the pipeline, one stage at a time, with a tiny check at each.
- Input: posed photos. Each photo comes with the camera's position, orientation and intrinsic parameters. Each pixel defines one ray
r(t) = o + t dfrom the camera centreoin directiond, following the Pinhole Camera Model. Check: a pixel at the image centre gives a ray straight ahead. - Sample points along the ray. Choose a near bound
t_nand a far boundt_f, split the interval into 64 equal bins, and draw one random point in each bin. This is stratified sampling: the points cover the whole ray, but their positions change each time, so over training the network sees a continuum of positions. Check: witht_n = 2andt_f = 6, each bin is 0.0625 wide. - Encode each point. Each position coordinate passes through the positional encoding, which gives 20 numbers per coordinate. Each direction coordinate gives 8 numbers. Check: for
p = 0.25with two frequencies, the encoding is(0.707, 0.707, 1, 0). - Query the network. An MLP takes the encoded position and outputs a density
sigmaand a 256-number feature vector. That vector is joined with the encoded direction and passed to one more layer, which outputs an RGB colourc. Only the colour depends on direction, so the geometry cannot change as the camera moves. Check: every sample now has a pair(c_i, sigma_i). - Accumulate along the ray. Each sample adds its colour, weighted by the fraction of light that reaches it (its transmittance) and by how much it absorbs. The result is one pixel colour. Check: a sample with density 0 contributes nothing; a very dense sample hides everything behind it.
- Compare and learn. Compare each rendered pixel with the photo's pixel using squared error, add these up over a batch of 4,096 random rays drawn from all photos, and update the weights with the Adam optimizer. Check: a rendered pixel that is too dark pushes the densities or colours along its ray in whichever direction reduces the error.
- Hierarchical sampling. Run a coarse network with 64 samples per ray. Its weights along the ray show where the surfaces are, so a fine network places 128 more samples where those weights are large. Check: a ray through empty air gets almost no fine samples.
- Output. Train on one scene for 100 to 300 thousand iterations. To render a new view, repeat steps 2 to 5 for every pixel of the new camera.
flowchart LR A[Posed photos] --> B[One ray per pixel] B --> C[Stratified samples along each ray] C --> D[Positional encoding of x and d] D --> E[MLP outputs density and colour] E --> F[Volume rendering: accumulate colour] F --> G[Compare with the photo pixel] G -->|gradient| E F --> H[New view after training]
The plot shows why density matters. Transmittance is the fraction of light that survives to distance t. A higher density makes it fall faster.
- density 1
- density 2
The math
A radiance field gives, for every 3D point x and direction d, a density sigma (at least zero) and an RGB colour c (values between 0 and 1). NeRF writes it as an MLP F_theta(x, d) = (c, sigma) with weights theta.
Step 2 in symbols
For bin i out of N, the sample t_i is drawn uniformly from t_n + ((i-1)/N)(t_f - t_n) to t_n + (i/N)(t_f - t_n). The gap between neighbouring samples is delta_i = t_(i+1) - t_i.
Step 5 in symbols
The continuous rendering integral is
The integral is replaced by a sum over the samples, with alpha_i = 1 - exp(-sigma_i delta_i) and T_i = exp(-(sum over j < i of sigma_j delta_j)):
This is the alpha compositing rule of Alpha Compositing, so the sum is differentiable in every sigma_i and c_i.
Step 3 in symbols
Each coordinate p is encoded as
Each of the three position coordinates uses L = 10, giving 60 numbers. Each of the three direction coordinates uses L = 4, giving 24.
Step 6 in symbols
The loss adds the squared error of the coarse and fine renders over a batch R of rays:
C(r) is the photo's pixel colour. The coarse term is kept so that the coarse weights are good enough to place the fine samples.
Step 7 in symbols
The coarse weights w_i = T_i alpha_i are normalised to w_hat_i = w_i / (sum over j of w_j). They form a piecewise-constant density along the ray. The fine samples are drawn from it by inverse transform sampling: draw a uniform number and find the bin where the cumulative sum crosses it.
A traced check
Take three samples with delta = 0.5, densities 0, 2 and 0.5, and grey colours 0.5, 0.8 and 0.2.
- Opacities:
alpha_1 = 0,alpha_2 = 1 - exp(-1.0) = 0.6321,alpha_3 = 1 - exp(-0.25) = 0.2212. - Transmittances:
T_1 = 1,T_2 = 1,T_3 = exp(-1.0) = 0.3679. - Weights:
0,0.6321,0.3679 x 0.2212 = 0.0814. - Pixel:
0 x 0.5 + 0.6321 x 0.8 + 0.0814 x 0.2 = 0.5220.
The empty first sample adds nothing. The dense second sample dominates, and the third sample is partly hidden. Had sample 2 been fully opaque, the pixel would be 0.8.
Results
The paper compares NeRF with three baselines. SRN is a scene representation network that predicts one surface feature per coordinate. NV is Neural Volumes, a 3D convolutional network that predicts a voxel grid. LLFF is Local Light Field Fusion, which predicts multiplane images and blends them. Table 1 reports peak signal-to-noise ratio (PSNR, in decibels, higher is better), structural similarity (SSIM, higher is better) and a learned perceptual distance (LPIPS, lower is better).
| Method | Diffuse synthetic PSNR | Realistic synthetic PSNR | Real forward-facing PSNR |
|---|---|---|---|
| SRN | 33.20 | 22.26 | 22.84 |
| NV | 29.62 | 26.05 | not evaluated |
| LLFF | 34.38 | 24.88 | 24.13 |
| NeRF | 40.15 | 31.01 | 26.50 |
On the realistic synthetic set, NeRF is 6.13 dB ahead of LLFF. Since PSNR is 10 log10(MAX^2 / MSE), a gain of 3 dB about halves the mean squared error, so 6.13 dB is roughly four times less error. LLFF keeps a slightly better LPIPS on the real forward-facing set (0.212 against 0.250). The paper asks readers to look at its supplementary video, where NeRF is more consistent across views.
Costs are the real tradeoff. Each scene needs its own training run, taking at least 12 hours for the single-scene baselines. One batch of 4,096 rays with 64 coarse and 128 fine samples each needs 4,096 x 192 = 786,432 network evaluations. At 100,000 iterations that is about 7.9 x 10^10 evaluations. The paper's own timing is 1 to 2 days per scene on one V100. Spread over 100,000 iterations, that is roughly 0.45 to 0.9 million network evaluations per second.
The ablations in Table 2 (realistic synthetic, averaged over eight scenes) show which pieces matter. Removing the positional encoding drops PSNR from 31.01 to 28.77. Removing view dependence drops it to 27.66. Removing hierarchical sampling drops it to 30.06. Using 25 input images instead of 100 gives 27.78, which still beats NV, SRN and LLFF at 100 images on every metric, according to the paper's supplement.
Limits: the method is for static scenes, it needs posed photos (the paper uses COLMAP to estimate poses for real data), and it needs one network per scene. A common misreading is that NeRF stores a mesh or grid; it stores a function, so resolution is not fixed by memory, but it also gives no explicit geometry to edit.
Reading guide
Read the paper in this order, with the lessons each part needs:
- Section 1 (Introduction): the three ideas, viewed as the pipeline above. Needs Volume Rendering and Pinhole Camera Model.
- Section 2 (Related Work): the baselines. Needs Alpha Compositing for LLFF's blending.
- Section 3 (Representation): the MLP
F_theta. Needs Feedforward Neural Network. - Section 4 (Volume rendering): equations 1 to 3. Needs Volume Rendering and Monte Carlo Method for the sampling view.
- Section 5.1 (Positional encoding): needs Positional Encoding and Fourier Transform for the intuition of frequencies.
- Section 5.2 (Hierarchical sampling): needs Importance Sampling for the comparison the paper draws.
- Section 5.3 (Implementation): the training loop; Adam is the only optimizer detail you need beyond gradient descent.
- Section 6 (Results): Tables 1 and 2. Needs no new lesson, but reading the Table 2 ablations is the best check of the design.
Check yourself
QuestionIn one sentence, what does the network take as input and what does it return for each sample along a ray?Show answer
It takes a 3D position x and a viewing direction d, and returns a density sigma and an RGB colour c. The density depends only on position, so the geometry does not change with the camera.
QuestionA ray has two samples with delta = 1, densities 0 and 3. What is the opacity of the second sample, and why does the first sample not matter?Show answer
The second sample has opacity 1 - exp(-3) = 1 - 0.0498 = 0.9502. The first sample has density 0, so its opacity is 1 - exp(0) = 0. Its weight is zero, so it adds no colour and does not change the transmittance behind it.
QuestionWhy does NeRF pass its inputs through a positional encoding instead of feeding raw coordinates to the MLP?Show answer
Deep networks tend to learn low-frequency functions first, so raw coordinates give smooth renderings that lose fine texture and sharp edges. Mapping each coordinate to sines and cosines at many frequencies lets the MLP represent high-frequency variation. Table 2 shows PSNR falling from 31.01 to 28.77 when it is removed.
QuestionA batch has 4,096 rays, with 64 coarse and 128 fine samples per ray. How many network evaluations does one batch need?Show answer
Each ray needs 64 + 128 = 192 samples, so one batch needs 4,096 x 192 = 786,432 evaluations.
QuestionA new camera sees a surface that the training photos never showed from that angle. Why can NeRF still render it plausibly, and where does it fail?Show answer
The network is a continuous function, so it interpolates between training views. It works when the new view is close to the training views and the surface was sampled well. It can fail for views far outside the training set, or for regions the photos never saw, because the network has no direct evidence there.
Sources
- Mildenhall et al., "NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis", arXiv:2003.08934 (2020). arxiv.org/abs/2003.08934
- Full text: arxiv.org/pdf/2003.08934