Abstract
This report provides the mathematical details of the gsplat library, a modular toolbox for efficient differentiable Gaussian splatting, as proposed by Kerbl et al. It provides a self-contained reference for the computations involved in the forward and backward passes of differentiable Gaussian splatting. To facilitate practical usage and development, we provide a user-friendly Python API that exposes each component of the forward and backward passes in rasterization at github.com/nerfstudio-project/gsplat.
Introduction
3D Gaussian Splatting (3DGS) has emerged as a powerful alternative to Neural Radiance Fields (NeRFs), offering high-quality real-time rendering by representing scenes as a collection of anisotropic 3D Gaussians. However, the original implementation of 3DGS relied on monolithic CUDA kernels that were difficult for the research community to modify, extend, or integrate into standard deep learning workflows.
The gsplat library was developed to address these limitations by providing a modular, Python-accessible framework. This document serves as the mathematical foundation for the library, detailing the rigorous derivations required to implement a fully differentiable rasterizer from scratch.
The Forward Pass: Projection and Rasterization
The rendering process in gsplat is divided into two primary stages: projecting 3D primitives into 2D image space and rasterizing those primitives into pixels.
3D to 2D Projection
Each 3D Gaussian is defined by a mean $\mu$ and a covariance matrix $\Sigma$. To project these into camera space, the library employs a perspective projection model. Because perspective projection is non-linear, a first-order Taylor expansion is used to approximate the projected 2D covariance $\Sigma'$. This involves the calculation of a Jacobian matrix $J$, representing the affine transformation of the camera projection at the Gaussian's center.
Alpha-Compositing
Once projected, the Gaussians are sorted by depth. The final color of a pixel is determined by blending the contributions of overlapping Gaussians using front-to-back $T$-accumulation (alpha-compositing). This process calculates the transmittance—the probability that light travels through preceding Gaussians to reach the observer—to weight the color contribution of each primitive.
The Backward Pass: Differentiable Rendering
The core utility of gsplat lies in its differentiability. To train a Gaussian Splatting model, one must propagate the loss gradient from the output image back to the underlying 3D parameters: position, rotation (quaternions), scale, opacity, and color.
Matrix Calculus and Frobenius Inner Products
To simplify the complex matrix calculus involved in the backward pass, the authors utilize the Frobenius inner product notation. This approach provides a streamlined way to derive gradients for matrix-valued functions, such as the transformation of covariance matrices.
Gradient Flow for Compositing
While the forward pass typically iterates front-to-back for computational efficiency, the backward pass for the compositing step is derived to iterate from back-to-front. This allows the gradient calculation to efficiently account for "downstream" visibility; the gradient of a specific Gaussian depends on the accumulated opacity of all Gaussians positioned in front of it.
Covariance and Rotation Parameterization
A critical challenge in 3DGS is ensuring that the 3D covariance matrix $\Sigma$ remains physically valid (positive semi-definite) during optimization. gsplat enforces this by parameterizing the covariance as $\Sigma = RSS^\top R^\top$, where $S$ is a diagonal scaling matrix and $R$ is a rotation matrix derived from a normalized quaternion. The supplement provides explicit Jacobians for backpropagating gradients through the quaternion components $(w, x, y, z)$, ensuring stable updates to the orientation of the Gaussians.
Key Mathematical Results
The supplement consolidates the entire differentiable pipeline into a unified set of equations (Equations 1 through 31). Notable highlights include:
- Equations 3 & 4: The definition of the affine transform $J$ and the resulting 2D covariance $\Sigma'$.
- Equation 18: The gradient derivation for the alpha-blending step, which is essential for updating the spatial and color parameters of the Gaussians.
- Equation 21: The gradient for the 2D covariance, which serves as a primary signal for "densification"—the process of splitting or cloning Gaussians to capture finer scene details.
Conclusion and Limitations
By documenting these derivations, gsplat enables a "modular toolbox" approach to radiance field research. Researchers can now modify specific components—such as the projection model or the loss function—without treating the renderer as a black box.
Currently, this supplement focuses on first-order derivatives suitable for standard optimization (e.g., Adam). It assumes a standard pinhole camera model; researchers utilizing non-standard optics (such as fisheye lenses) would need to derive a custom Jacobian $J$ for the projection step. Future iterations of the library may expand to include higher-order derivatives and broader camera model support.
Summary updated