9B. 3D Gaussian Splatting

Gaussian primitives, splatting pipeline, spherical harmonics, covariance decomposition, adaptive density control

Contents
1. Motivation: Why Not NeRF? 2. Gaussian Fundamentals (1D, 2D, 3D) 3. 3D Gaussian as a Scene Primitive 4. Method Overview 5. Initialization via SfM 6. Rendering: Projection (3D to 2D) 7. Rendering: Rasterization and Alpha Compositing 8. Spherical Harmonics for View-Dependent Color 9. Covariance Decomposition (Scale + Rotation) 10. Loss Function 11. Adaptive Density Control 12. NeRF vs 3DGS Comparison 13. Future Directions Interactive: Splatting Pipeline Walkthrough Flashcards

1. Motivation: Why Not NeRF?

NeRF (Module 9A) achieves impressive novel view synthesis but is painfully slow to render. The bottleneck is multi-level nesting: for each pixel, cast a ray; for each ray, sample many points; for each sampled point, query the MLP. This makes real-time rendering impossible.

NeRF rendering cost (one training iteration)
$$1080 \times 1920 \times 100_{\text{samples/ray}} \times 100_{\text{images}} = 20.7 \text{ billion MLP evaluations}$$
Problem with NeRF3DGS Solution
Implicit representation (MLP)Explicit representation (3D Gaussians)
Ray marching requiredNo ray marching — project (splat) Gaussians instead
Slow GPU utilizationTile-based rasterization for GPU parallelism
Per-point MLP query at render timeNo neural network at render time
Core Idea of 3DGS
Represent a 3D scene as a set of 3D Gaussian distributions scattered in space. To render a novel viewpoint: (1) Splat (project) each 3D Gaussian onto the 2D camera plane. (2) Composite the projected 2D Gaussians using alpha blending. No ray marching, no MLP queries at render time.

2. Gaussian Fundamentals (1D, 2D, 3D)

1D Gaussian

$$G(x) = \exp\!\left(-\frac{(x - \mu)^2}{2\sigma^2}\right)$$

$\mu$: mean (center of the bell curve). $\sigma$: standard deviation (spread). The familiar bell curve shape.

1D Gaussian bell curve
1D Gaussian: a bell curve defined by mean $\mu$ and standard deviation $\sigma$.

2D Gaussian

$$G(\mathbf{p}) = \exp\!\left(-\frac{1}{2}(\mathbf{p} - \boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1} (\mathbf{p} - \boldsymbol{\mu})\right)$$

$\mathbf{p} = (x, y)^T$: query point. $\boldsymbol{\mu} = (\mu_x, \mu_y)^T$: center. $\boldsymbol{\Sigma}$: $2 \times 2$ covariance matrix encoding both spread and orientation (off-diagonal terms tilt the ellipse).

2D Gaussian elliptical heatmap
2D Gaussian heatmap: the covariance matrix determines the shape and tilt of the elliptical distribution.

3D Gaussian

$$G(\mathbf{p}) = \exp\!\left(-\frac{1}{2}(\mathbf{p} - \boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1} (\mathbf{p} - \boldsymbol{\mu})\right)$$

$\mathbf{p} \in \mathbb{R}^3$: 3D query point. $\boldsymbol{\mu} \in \mathbb{R}^3$: 3D mean position. $\boldsymbol{\Sigma} \in \mathbb{R}^{3 \times 3}$: 3D covariance matrix. The 3D Gaussian forms an ellipsoid in 3D space. The eigenvectors of $\boldsymbol{\Sigma}$ determine orientation; eigenvalues determine the extent along each principal axis.

3D Gaussian rendered as ellipsoid point cloud
A 3D Gaussian rendered as a point cloud, showing the ellipsoidal shape determined by the covariance matrix.

3. 3D Gaussian as a Scene Primitive

A 3D Gaussian shape alone is not enough — we also need appearance. Each Gaussian has four groups of learnable parameters:

ParameterSymbolDescriptionDimension
Position (mean)$\boldsymbol{\mu}_i$Center of the Gaussian in 3D3
Covariance$\boldsymbol{\Sigma}_i$Shape and orientation of the ellipsoid$3 \times 3$ symmetric
Opacity$\alpha_i$How transparent the Gaussian is1
Color (SH coefficients)$\mathbf{k}_i$View-dependent appearance48 (degree 3)
Influence Function of Gaussian $i$
$$f_i(\mathbf{p}) = \sigma(\alpha_i) \cdot \exp\!\left(-\frac{1}{2}(\mathbf{p} - \boldsymbol{\mu}_i)^T \boldsymbol{\Sigma}_i^{-1} (\mathbf{p} - \boldsymbol{\mu}_i)\right)$$

$\sigma(\alpha_i)$ = sigmoid-activated opacity ensuring $\alpha_i \in [0,1]$. Points far from $\boldsymbol{\mu}_i$ receive near-zero contribution. The shape of $\boldsymbol{\Sigma}_i$ determines how quickly influence falls off in each direction.

Gaussian influence function with 3D ellipsoid
Each Gaussian is a fuzzy, semi-transparent, colored ellipsoid. Position, covariance, opacity, and color are all independently learnable.
Visual intuition
Each Gaussian is a fuzzy, semi-transparent, colored ellipsoid. Moving the mean shifts it in space. Changing the covariance stretches or rotates it. Changing opacity makes it more or less see-through. Changing color changes its appearance (possibly view-dependent via spherical harmonics).

4. Method Overview

The full 3DGS pipeline has two flows: a forward (operation) flow and a backward (gradient) flow.

Full 3DGS pipeline overview
Full 3DGS pipeline: SfM points initialize Gaussians; projection and tile rasterization produce the rendered image; adaptive density control updates the set of Gaussians via gradient flow.

Three main stages:

  1. Initialization: Create initial 3D Gaussians from the SfM sparse point cloud
  2. Rendering: Project (splat) Gaussians to 2D, then alpha-composite to produce the image
  3. Optimization: Update Gaussian parameters via gradient descent and adaptive density control

5. Initialization via Structure-from-Motion

Just like NeRF, the input is a set of images from different viewpoints. Structure-from-Motion (COLMAP) provides:

Each SfM point becomes the initial position $\boldsymbol{\mu}$ for one Gaussian. All Gaussians are initialized as spherical (isotropic covariance, identity-like $\boldsymbol{\Sigma}$). Colors can be initialized from the SfM point colors.

SfM initialization of 3D Gaussians
SfM initialization: multiple camera viewpoints triangulate a sparse 3D point cloud; each point seeds a 3D Gaussian.
Limitation and alternative
The SfM point cloud is sparse; some regions may be under-represented at initialization. Adaptive Density Control (Section 11) addresses this dynamically during training. Alternatively, feedforward methods like MASt3R can predict dense point maps directly from image pairs, giving a much richer starting point.

6. Rendering: Projection (3D to 2D)

To render from a given camera viewpoint, each 3D Gaussian is projected (splatted) onto the 2D camera plane. A key mathematical property makes this tractable: the projection of a 3D Gaussian through a perspective camera is (approximately) a 2D Gaussian in the image plane.

Projection Equations

Mean projection (standard pinhole camera model):

$$\boldsymbol{\mu}_{2D} = \text{proj}(\mathbf{K} \cdot \mathbf{W} \cdot \boldsymbol{\mu}_{3D})$$

Covariance projection (using the Jacobian of the projective transform):

$$\boldsymbol{\Sigma}_{2D} = \mathbf{J} \mathbf{W} \boldsymbol{\Sigma}_{3D} \mathbf{W}^T \mathbf{J}^T$$

$\mathbf{W} = [\mathbf{R}|\mathbf{t}]$: world-to-camera transform (extrinsics). $\mathbf{K}$: camera intrinsics. $\mathbf{J}$: Jacobian of the affine approximation of the projective transformation.

3D to 2D projection
3D Gaussian projected through a camera: the 3D mean projects to a 2D center; the 3D covariance projects to a 2D covariance via the Jacobian.
Why this is key
This projection is analytical — no sampling or ray marching required. The 2D Gaussian parameters are computed directly from the 3D parameters and the camera model. This is the fundamental reason 3DGS avoids the sampling bottleneck that slows NeRF.

7. Rendering: Rasterization and Alpha Compositing

Once all 3D Gaussians are projected into 2D, the image is constructed via a differentiable tile-based rasterizer.

Algorithm

  1. Sort all projected Gaussians by depth (distance from camera), nearest to furthest
  2. For each pixel: iterate over depth-sorted overlapping Gaussians; accumulate color using alpha blending
3DGS Rendering Equation
$$C(\mathbf{p}) = \sum_{i=1}^{N} \mathbf{c}_i \cdot \alpha_i'(\mathbf{p}) \cdot T_i(\mathbf{p})$$

Effective alpha at pixel $\mathbf{p}$:

$$\alpha_i'(\mathbf{p}) = \alpha_i \cdot \exp\!\left(-\frac{1}{2}(\mathbf{p} - \boldsymbol{\mu}_{2D,i})^T \boldsymbol{\Sigma}_{2D,i}^{-1} (\mathbf{p} - \boldsymbol{\mu}_{2D,i})\right)$$

Transmittance:

$$T_i(\mathbf{p}) = \prod_{j=1}^{i-1} \left(1 - \alpha_j'(\mathbf{p})\right)$$

For each pixel, the final color is a weighted sum of all contributing Gaussian colors. The weight of each Gaussian depends on:

  1. How close the pixel is to the Gaussian's projected 2D center (Gaussian falloff)
  2. How opaque the Gaussian is (learned opacity $\alpha_i$)
  3. How much the Gaussians in front have already blocked the light (transmittance $T_i$)
Connection to NeRF volume rendering

The transmittance term $T_i(\mathbf{p}) = \prod_{j < i}(1 - \alpha_j'(\mathbf{p}))$ is mathematically identical to the discrete transmittance in NeRF volume rendering. The key difference is that in 3DGS, there is no ray marching: the Gaussians themselves define where matter is, and the projection is computed analytically. NeRF queries a neural network at sampled points; 3DGS evaluates the 2D Gaussian function at the pixel location.

8. Spherical Harmonics for View-Dependent Color

Real surfaces exhibit view-dependent appearance: specular reflections, glossy highlights, metallic sheen. A single fixed RGB color per Gaussian cannot capture these effects. Instead, each Gaussian stores Spherical Harmonics (SH) coefficients defining a view-dependent color function.

SH Color Evaluation
$$\mathbf{c}_i(\mathbf{d}) = \sum_{l=0}^{l_{\max}} \sum_{m=-l}^{l} \mathbf{k}_{i,l,m} \cdot Y_l^m(\mathbf{d})$$

$Y_l^m(\mathbf{d})$: spherical harmonics basis functions (degree $l$, order $m$). $\mathbf{k}_{i,l,m} \in \mathbb{R}^3$: learnable SH coefficients per Gaussian per color channel. $\mathbf{d}$: viewing direction. 3DGS typically uses $l_{\max} = 3$.

SH Degree $l_{\max}$Coefficients per channelTotal (RGB)Captures
013Constant color (no view-dependence)
1412Basic directional lighting
2927Soft specular highlights
31648Sharp specular, complex reflections
Spherical harmonics basis functions
Spherical harmonics basis functions $Y_l^m$ organized by degree (rows) and order (columns), showing increasingly complex directional patterns.
Key insight
Without spherical harmonics, each Gaussian would have a single fixed RGB color regardless of viewing direction. Surfaces that appear shiny, metallic, or reflective in real life would look flat and unrealistic. SH coefficients are learnable parameters — higher degree allows more accurate view-dependent effects but requires more memory per Gaussian (48 scalars for degree 3 vs 3 scalars for degree 0).

9. Covariance Decomposition (Scale + Rotation)

The Problem with Direct Optimization

The covariance matrix $\boldsymbol{\Sigma}$ must be positive semi-definite (PSD) and invertible for the Gaussian to be valid. If we directly optimize the 6 unique elements of $\boldsymbol{\Sigma}$, gradient descent can produce matrices that are not PSD (negative eigenvalues) or not invertible, making the Gaussian undefined.

The Solution: Scale + Rotation Decomposition

Covariance Decomposition
$$\boldsymbol{\Sigma} = \mathbf{R} \mathbf{S} \mathbf{S}^T \mathbf{R}^T$$

$\mathbf{S} = \text{diag}(s_x, s_y, s_z)$: diagonal scale matrix (3 parameters, stored as log-scale for positivity). $\mathbf{R}$: rotation matrix (derived from a unit quaternion $\mathbf{q} = (q_w, q_x, q_y, q_z)$, 4 parameters). Since $\mathbf{S}\mathbf{S}^T$ is always PSD and $\mathbf{R}$ is orthogonal, the result is guaranteed to be positive semi-definite.

Per-Gaussian Optimizable Parameters

ParameterSymbolScalars
Position$\boldsymbol{\mu}$3
Scale$(s_x, s_y, s_z)$3
Rotation quaternion$(q_w, q_x, q_y, q_z)$4
Opacity$\alpha$1
SH coefficients (degree 3)$\mathbf{k}$48
Total59
Why quaternions for rotation?

A rotation matrix $\mathbf{R}$ has 9 elements but only 3 degrees of freedom (subject to orthogonality constraints). Quaternions provide a compact 4-parameter representation that avoids gimbal lock, supports smooth interpolation, and is easy to normalize during optimization to maintain the unit-norm constraint. The quaternion-to-rotation-matrix conversion is a standard closed-form formula.

10. Loss Function

3DGS Combined Loss
$$\mathcal{L} = (1 - \lambda) \cdot \mathcal{L}_1 + \lambda \cdot \mathcal{L}_{\text{D-SSIM}}$$

$\mathcal{L}_1$: pixel-wise absolute difference: $\frac{1}{|\mathcal{P}|}\sum_\mathbf{p} |C_{\text{pred}}(\mathbf{p}) - C_{\text{GT}}(\mathbf{p})|$

$\mathcal{L}_{\text{D-SSIM}}$: differentiable SSIM loss. $\text{D-SSIM} = (1 - \text{SSIM})/2$, where SSIM compares luminance, contrast, and structural similarity. Captures perceptual quality beyond pixel accuracy.

$\lambda$: hyperparameter balancing the two terms.

SSIM example with noisy image
SSIM is highly sensitive to structural degradation: an image corrupted with noise has a very low SSIM score (0.024), illustrating how SSIM captures perceptual quality beyond per-pixel error.
Why combine L1 and D-SSIM?
L1 ensures pixel-accurate color reconstruction. D-SSIM ensures perceptually pleasing structural quality (sharp edges, coherent structures). Together they produce sharper, more visually coherent results than either alone. This contrasts with NeRF, which uses only a simple L2 loss.

11. Adaptive Density Control

The initial SfM point cloud is sparse. Some regions are under-represented; some Gaussians may grow too large and cover areas they should not. Adaptive density control dynamically adjusts the number of Gaussians during optimization.

Three Operations

Cloning (Under-Reconstruction)
Trigger: high positional gradient magnitude AND the Gaussian is small. The Gaussian is duplicated and the clone is moved toward the under-represented region. Both original and clone then refine their parameters independently.
Splitting (Over-Reconstruction)
Trigger: high positional gradient magnitude AND the Gaussian is large. The large Gaussian is replaced by two smaller Gaussians, each with reduced scale. This enables finer detail in the region.
Pruning (Unnecessary Gaussians)
Trigger: opacity $\alpha \approx 0$ (Gaussian has become nearly transparent). The Gaussian is removed to save memory and computation.
Adaptive density control: cloning and splitting
Adaptive density control: under-reconstruction is handled by cloning small Gaussians; over-reconstruction is handled by splitting large Gaussians into two smaller ones.
Why use positional gradient as the trigger?

A large gradient on the Gaussian's position $\boldsymbol{\mu}$ means the optimizer is trying to move the Gaussian to better explain the training images, but cannot do so sufficiently with a single Gaussian. This indicates the region needs better coverage (more Gaussians). The gradient magnitude threshold $\tau_{\text{pos}}$ is set empirically by the authors. Adaptive density control is applied periodically during training (not every iteration).

12. NeRF vs 3DGS Comparison

AspectNeRF3D Gaussian Splatting
RepresentationImplicit (MLP weights)Explicit (set of 3D Gaussians)
Rendering approachRay marching: cast ray per pixel, sample points, query MLPSplatting: project Gaussians to 2D, composite
Sampling requiredYes — points along each rayNo — projection is analytical
Wasted computationEmpty space still requires MLP queriesOnly Gaussians that overlap a pixel contribute
GPU efficiencySequential per-ray processingTile-based parallel rasterization
SpeedSlow (seconds per frame)Real-time (>30 FPS)
Training timeHoursMinutes
MemoryFixed (network size, <10 MB)Scales with scene complexity
EditabilityDifficult (encoded in weights)Easier (move/delete/add Gaussians)
QualityHighHigh (comparable or better)
Why 3DGS is faster
(1) No ray marching: NeRF wastes computation on empty regions; 3DGS only processes Gaussians where they exist. (2) No MLP at render time: NeRF queries a neural network at every sampled point; 3DGS uses pre-computed Gaussian parameters. (3) GPU-friendly rasterization: the tile-based rasterizer divides the image into tiles, assigns Gaussians to tiles, and processes tiles in parallel on GPU. (4) Explicit storage: direct memory access rather than network inference.

13. Future Directions

4D Gaussian Splatting (Dynamic Scenes)

Standard 3DGS only handles static scenes. 4DGS (Wu et al., 2024) adds a deformation field $F(\mathbf{G}, t)$ that deforms Gaussians over time. At time $t$, the original Gaussians $\mathbf{G}$ are warped to $\mathbf{G}' = F(\mathbf{G}, t)$ and then rendered normally. Limitation: requires training over the full video sequence.

4DGS dynamic scene deformation
4DGS: original 3D Gaussians are deformed via a deformation field $F(\mathbf{G}, t_i)$ to produce time-varying Gaussians, then rasterized from the camera viewpoint.

Feedforward Methods (Splatt3r, MASt3R)

Splatt3r: Zero-Shot Gaussian Splatting

Splatt3r (Smart et al., 2024) is a feedforward neural network that directly predicts Gaussian parameters from uncalibrated image pairs — no SfM, no per-scene optimization. Uses a frozen MASt3R backbone with additional prediction heads. Works zero-shot on new scenes. Currently limited to static scenes.

Splatt3r architecture
Splatt3r: frozen MASt3R backbone (ViT encoder + transformer decoder) with prediction heads for 3D Gaussian parameters.
MASt3R: Dense Point Map Prediction

MASt3R provides a denser alternative to SfM for initialization. A ViT encoder-decoder architecture takes two patchified images and uses cross-attention between views to predict per-pixel 3D point maps and confidence maps. These dense point maps can directly initialize Gaussians at much higher density than sparse SfM.

MASt3R architecture
MASt3R: two images through ViT encoders and cross-attention transformer decoders produce per-pixel 3D point maps and confidence maps.

Human Avatars (Gaussian Avatars)

3DGS can create animatable human avatars by initializing Gaussians on an SMPL parametric body mesh. Non-rigid and rigid (kinematic tree) deformations match the person's shape and pose. Once trained, the avatar can be animated with novel poses via pose transfer.

Human avatar pipeline using 3DGS
Human avatar pipeline: canonical SMPL Gaussians undergo non-rigid and rigid deformation, then differentiable rasterization, with reconstruction loss against ground truth video.

Flashcards