## 3 Methods
### Formulation  
In NeRF, it is assumed that the scene is composed of luminous particles with a density that can change. The magnitude of the density determines whether there is an object at a given position for the ray. The density field is denoted by \(\sigma(\mathbf{x})\), where \(\mathbf{x}\in\mathbb{R}^{3}\) indicates the distribution of density in space. We re-parameterize \(\mathbf{x}\) using the center of the camera and the pixels on the imaging plane to determine the origin \(\mathbf{o}\) and direction \(\mathbf{d}\) of the ray. Any point \(\mathbf{x}\) along the ray can be represented as \(\mathbf{r}(t)=\mathbf{o}+t\mathbf{d}\). The color and density of the scene can be represented by the continuous function \(F_{\theta}\), where \(\theta\) denotes the parameters of the neural network.  
\[F_{\theta}:(\mathbf{r}(t),\mathbf{d})\rightarrow(\mathbf{c},\sigma) \tag{1}\]  
where \(\mathbf{c}\) is the color vector and \(\sigma\) is the scalar for density. The choice of mapping method for the neural network directly affects its efficiency and output quality. In NeRF, there are mainly two ways to map \(F_{\theta}\). One is the neural network mapping based on MLP, which has the advantage of occupying less storage space but has a slower convergence speed. The process for this mapping can be detailed in the following formula.  
\[(\sigma,\mathbf{c})=MLP_{out}(MLP_{pos}(PositionEncoding(\mathbf{x})), DirectionEncoding(\mathbf{d})) \tag{2}\]  
\(MLP_{pos}\) is a multi-layer perceptron network that encodes positional information, while \(MLP_{out}\) is another MLP tasked with outputting color and density.  
Another is the neural network mapping based on multi-resolution hash encoding. It has the advantage of converging while maintaining high accuracy. The process for this mapping can also be represented by the subsequent formula.  
\[(\sigma,\mathbf{c})=MLP_{out}(HashGrid(\mathbf{x}),DirectionEncoding( \mathbf{d})) \tag{3}\]  
The final color is determined by the volume rendering formula:  
\[C(\mathbf{r})=\int_{near}^{far}T(t)\cdot\sigma(t)\cdot\mathbf{c}(t)dt \tag{4}\]  
\(C(\mathbf{r})\) is the color observed along the ray \(\mathbf{r}\). \(T(t)\) is the transmittance accumulation function, and the range of integration is from \(near\) to \(far\), representing the interval along the ray from the nearest point to the farthest point.  
Given a sequence of images denoted by \(\{I_{i}\}_{i=1}^{m}\), \(m\) is the total number of images and \(i\) is the index of the image. The origin o and direction \(\mathbf{d}\) are determined by the camera pose \(\mathbf{p}\) and pixel position \(u\). Specifically, the origin \(\mathbf{o}\) is primarily determined by the camera pose and can be represented as \(\{\mathbf{o}(\mathbf{p_{i}})\}_{i=1}^{m}\). The direction \(\mathbf{d}\) is determined by both \(\mathbf{p}\) and \(u\), and can be represented as \(\{\mathbf{d}(\mathbf{p_{i}},u_{j})\}_{i=1,j=2}^{m,n}\),where \(n\) is the number of pixels in an image and \(j\) is the index of the pixel.  
Finally, gradient descent and backpropagation are used to minimize the loss function and optimize the camera and neural radiance field parameters. The formula is presented below. This expression denotes the estimated pixel value, while \(l\) can assume values of 1 or 2, corresponding to the \(L_{1}\) and \(L_{2}\) norms, respectively. \(\hat{l}\) represents the estimated value of the pixel with index \(u_{j}\) in the \(i\)-th image.  
\[\min_{\mathbf{p_{1}}\cdots\mathbf{p_{m}},\theta}\sum_{i=1}^{m}\sum_{j=1}^{n}|| \hat{l}(u_{j};\mathbf{p_{i}},\theta)-I_{i}(u_{j})||_{l} \tag{5}\]