NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
Paper: https://arxiv.org/abs/2003.08934
Input / Output
- : 3D location
- : Viewing direction
- : emitted color
- volume density (much like opacity)
- This only depends on to have a consistency across viewpoints
Rendering (Basics)
Rendering is stragiht-forward: (classic) volume rendering
- : volume density at position
- : the color at position viewed from direction
- : the probability that the ray travels from to :
Approximating this integral with the sum over discrete bins will suffer from low resolution.
In practice, they use hierarchical version of stratified sampling.
- stratified sampling: Helps to simulate smoother integration than relying on discrete uniform bins.
- hierarchical: Helps to allocate more samples to the region that affects rendering (i.e., avoid sampling a lot from empty space!)
![method](/media/posts/nerf/method.png =900x)
:::details Stratified Sampling It partitions into evenly-spaced bins and then draw one sample uniformly at random from within each bin:
It can simulate sampling from the entire space. :::
Key ideas / components
Naively training the network with above idea doesn't work. The key ideas are:
- Encouraging the representation to be multiview consistent
- restricting the network to predict as a function of only the location
- is predicted as a function of both location and viewing direction
- Positional encoding
- It's a common knowledge that (sinusoidal) positional encoding helps NNs to fit to high-freq signal:
- Hierarchical sampling procedure
- Details below
Minor:
- Viewing direction is concatenated to the feature vector in a middle layer of the network
Training NeRF: Hierarchical sampling
Hierarchical sampling allocates more samples to the region that affects final rendering.
They simultaneously optimize two networks: coarse one and fine one.
-
Sample a set of locations along the ray using stratified sampling
-
Evaluate the coarse network at these locations:
-
Compute coarse rendering based on the samples:
- : the distance between adjacent samples
- : the probability that the ray reaches the point
- : volume density (i.e., opacity)
-
Normalize the above weights to form a piecewise-constant PDF along the ray, and sample a second set of locations from this distribution.
-
Evaluate the fine network at the all locations:
-
Compute the final rendered color using all samples
- Notice that second set of samples are biased towards region with higher