Download docs/rendering.md from SiddhuG01/PanoGS: direct link, hf CLI and curl.
- Browser
- Download file 3.48 kB
-
https://huggingface.co/spaces/SiddhuG01/PanoGS/resolve/main/docs/rendering.md
- Command line
-
hf download hf://spaces/SiddhuG01/PanoGS/docs/rendering.md
-
curl -L -o rendering.md https://huggingface.co/spaces/SiddhuG01/PanoGS/resolve/main/docs/rendering.md
A newer version of the Gradio SDK is available: 6.32.0
3D Gaussian Splatting CPU Renderer & Camera Geometry
The PanoGS rendering pipeline implements perspective camera geometry, affine Jacobian projection, 2D covariance computation, depth sorting, and front-to-back Over-operator alpha compositing.
1. Camera Projection & Viewport Geometry
Pinhole Perspective Model
Given image dimensions $(W, H)$ and horizontal field of view $\text{FoV}_x$, the focal lengths and principal point are computed as:
World coordinates $\mathbf{P}_w \in \mathbb{R}^3$ are mapped to camera coordinate space $\mathbf{P}_c = (t_x, t_y, t_z)^T$:
The 2D screen coordinate $(x_s, y_s)$ is obtained via central projection:
2. Jacobian Matrix & 2D Covariance
Following the formulation in 3D Gaussian Splatting for Real-Time Radiance Field Rendering (Kerbl et al., SIGGRAPH 2023), the 3D Gaussian covariance $\mathbf{\Sigma} \in \mathbb{R}^{3 \times 3}$ is projected into 2D image plane covariance $\mathbf{\Sigma}' \in \mathbb{R}^{2 \times 2}$ using the local affine approximation:
Where:
- $\mathbf{W} = \mathbf{R}_{view}$ is the camera rotation transformation.
- $\mathbf{J} \in \mathbb{R}^{2 \times 3}$ is the Jacobian matrix of the perspective projection evaluated at $\mathbf{P}_c = (t_x, t_y, t_z)$:
- $s = 0.3$ is a low-pass Gaussian antialiasing filter applied to the diagonal of $\mathbf{\Sigma}'$ to prevent sub-pixel sampling artifacts.
The 2D Gaussian bounding box radius is bounded by:
3. Front-to-Back Alpha Compositing (The Over Operator)
Gaussians in front of the camera ($t_z > \text{min_depth}$) are sorted in strictly ascending order of depth $t_z$:
For each pixel $\mathbf{p} = (u, v)^T$ within the bounding box of Gaussian $i$:
- Quadratic Form Evaluation: $$\Delta = \mathbf{p} - \mathbf{x}_{s,i}$$ $$G_i(\mathbf{p}) = \exp\left( -\frac{1}{2} \Delta^T (\mathbf{\Sigma}'_i)^{-1} \Delta \right)$$
- Alpha Density: $$\alpha_i(\mathbf{p}) = \sigma(o_i) \cdot G_i(\mathbf{p})$$
- Color Accumulation & Transmittance: $$C(\mathbf{p}) \leftarrow C(\mathbf{p}) + c_i \cdot \alpha_i(\mathbf{p}) \cdot T(\mathbf{p})$$ $$T(\mathbf{p}) \leftarrow T(\mathbf{p}) \cdot (1 - \alpha_i(\mathbf{p}))$$ where $T(\mathbf{p})$ initializes to $1.0$.
When $T(\mathbf{p}) < 10^{-4}$, the pixel is fully saturated and early-ray-termination skips subsequent Gaussians.
4. CLI Usage
Render a perspective view from an orbital camera:
# Render to default 512x512 with white background
panogs render output/gaussians.ply -o output/rendered.png --distance 2.0 --elevation 10.0 --azimuth 30.0
# Render with black background
panogs render output/gaussians.ply -o output/rendered.png --bg black --distance 1.5