Search

Search papers and lessons

Gaussian Splatting

Level 4 · 11 min read

A scene is stored as millions of 3D Gaussian blobs that are projected onto the image, sorted by depth and alpha-blended, which renders novel views in real time after optimization.

On this page

  • Colour = topic mix
  • Probability
  • Calculus
  • Linear algebra
  • Computer vision
  • Losses & regularization
  • Optimizers
  • Sign in to see your progress

TL;DR

Gaussian splatting represents a captured scene as a cloud of soft, stretched 3D blobs. Each blob has a position, a shape, a colour and an opacity. To draw a picture from a new camera, every blob is flattened onto the image plane, the blobs are sorted front to back, and their colours are blended with the alpha-compositing rule. The blobs are fitted to the photographs by gradient descent, which is what makes the result both accurate and fast to draw.

Before this, the best photorealistic methods were slow to draw, and the fast ones were blurry. Splatting closed that gap for real scenes at 1080p.

Where you'll see it: real-time viewers that let you walk around a room or a street reconstructed from ordinary photos or video, and in research on fast 3D capture.

Intuition

Paint the scene with soft blobs

Picture a scene made of fog instead of solid surfaces. Each small patch of fog is dense at its centre and thins out towards its edge, like a soft snowball. Some patches are long and flat, like a leaf. Some are tiny, for fine detail. Place a few million of them in the right spots, give each one a colour and a transparency, and the fog looks like the scene from every direction.

That is the representation. The name comes from what happens at render time. Each 3D blob is "splatted" onto the screen as a 2D soft spot, and the spots are composited in depth order.

Why blobs and not a neural network? A neural radiance field (NeRF) asks an MLP for the colour and density at every sampled point along every pixel ray. That is accurate, but each pixel costs many network evaluations. Earlier point-based methods were fast, but holes and noise showed up where the points were sparse. Gaussians sit in between. They are continuous, so gradients flow through them smoothly, yet they are explicit objects, so a GPU can draw them with a sort and a blend.

The optimization starts from the points that structure-from-motion already produced while calibrating the cameras, then it places, stretches, splits and removes blobs until the renders match the photographs.

−3−2−1012300.20.40.60.81distance from centrefootprint weight
  • σ = 1
  • σ = 0.5
A one-dimensional cross-section of two blobs. The narrower blob keeps its peak but covers less of the image.
flowchart LR
  A["Calibrated photos"] --> B["SfM points"]
  B --> C["One blob per point"]
  C --> D["Project and sort per tile"]
  D --> E["Alpha-blend to image"]
  E --> F["Compare with photo"]
  F --> G["Gradient step on blob parameters"]
  G --> H["Add, split or prune blobs"]
  H --> D

The math

One blob in 3D

A 3D Gaussian is centred at a point μ∈R3\boldsymbol{\mu} \in \mathbb{R}^3. Its shape is set by a covariance matrix Σ\Sigma, a 3×33 \times 3 symmetric matrix. The unnormalised density at a point x\mathbf{x} is

G(x)=exp⁡ ⁣(−12 (x−μ)T Σ−1 (x−μ)).G(\mathbf{x}) = \exp\!\left(-\tfrac{1}{2}\,(\mathbf{x}-\boldsymbol{\mu})^{\mathsf{T}}\,\Sigma^{-1}\,(\mathbf{x}-\boldsymbol{\mu})\right).

Level sets of GG are ellipsoids. The directions of the ellipsoid axes come from the eigenvectors of Σ\Sigma, and the lengths come from its eigenvalues. This is the same picture as in the covariance matrix lesson.

Optimizing Σ\Sigma directly is a bad idea. A gradient step can push it to a matrix that is not positive semi-definite, which does not describe any ellipsoid. The paper therefore builds the matrix from two parts that are always valid:

Σ=R S ST RT.\Sigma = R\,S\,S^{\mathsf{T}}\,R^{\mathsf{T}}.

Here SS is a diagonal matrix of three positive scales, and RR is a rotation matrix (see Rotation Matrix). The scales are stored as a vector s\mathbf{s} passed through an exponential, which keeps them positive. The rotation is stored as a quaternion q\mathbf{q}, normalised to a unit rotation. Since SSTS S^{\mathsf{T}} is diagonal with non-negative entries and RR is orthogonal, Σ\Sigma is always a valid covariance. Gradient descent (see Gradient Descent) can then move s\mathbf{s} and q\mathbf{q} freely.

Projecting a blob onto the image

To draw a blob, the paper projects it to the screen. Let WW be the world-to-camera transform and JJ the Jacobian of the local affine approximation of the perspective projection (see Jacobian Matrix and Pinhole Camera Model). The camera-space covariance is WΣWTW \Sigma W^{\mathsf{T}}, and the 2D covariance on the image plane is

Σ′=J W Σ WT JT.\Sigma' = J\,W\,\Sigma\,W^{\mathsf{T}}\,J^{\mathsf{T}}.

The 2D blob is centred on the projected centre of the 3D blob and has covariance Σ′\Sigma'. This is the Zwicker-style projection that the paper cites.

Blending along a pixel

Each blob also has an opacity o∈[0,1)o \in [0, 1), produced by a sigmoid so that it stays in range (see Sigmoid Function). For a pixel p\mathbf{p}, blob ii contributes an effective alpha

αi=oi⋅exp⁡ ⁣(−12 (p−μi′)T Σi′−1 (p−μi′)).\alpha_i = o_i \cdot \exp\!\left(-\tfrac{1}{2}\,(\mathbf{p}-\boldsymbol{\mu}'_i)^{\mathsf{T}}\,\Sigma'^{-1}_i\,(\mathbf{p}-\boldsymbol{\mu}'_i)\right).

Sort the blobs by depth, nearest first. The pixel colour is then the over-operator sum from Alpha Compositing:

C=∑i=1Nci αi∏j=1i−1(1−αj).C = \sum_{i=1}^{N} c_i\,\alpha_i\prod_{j=1}^{i-1}(1-\alpha_j).

Here cic_i is the colour of blob ii. The product is the transmittance: how much light survives the blobs in front. The paper also writes it as a running quantity Ti=∏j<i(1−αj)T_i = \prod_{j \lt i}(1-\alpha_j), so each blob adds TiαiciT_i \alpha_i c_i.

Colour is not a single number per blob. It is a view-dependent colour given by spherical harmonic coefficients, so that shiny or directional lighting can look different from different angles.

Training loss

Renders are compared to the photographs with a mix of an absolute-difference term and a structural term:

L=(1−λ) L1+λ LD-SSIM,λ=0.2.\mathcal{L} = (1-\lambda)\,\mathcal{L}_1 + \lambda\,\mathcal{L}_{\text{D-SSIM}}, \qquad \lambda = 0.2.

L1\mathcal{L}_1 is the mean absolute pixel difference. LD-SSIM\mathcal{L}_{\text{D-SSIM}} is one minus the structural similarity index, divided by two, so that it is zero when the images match.

Density control

Gradient descent alone cannot move blobs into empty regions or split a blob that covers too much. So every 100 iterations the method adjusts the set of blobs:

  • If a blob has a large average magnitude of view-space position gradient above τpos=0.0002\tau_{\text{pos}} = 0.0002, it is in a region the model cannot fit. A small blob is cloned, and a large blob is split into two smaller ones.
  • Any blob whose opacity falls below a threshold ϵα\epsilon_\alpha is removed, and very large blobs are removed periodically.

Density control is what turns a sparse starting cloud into a dense, detailed one.

Worked examples

Example
One blob, with and without rotation

Take a 2D blob with scales sx=2s_x = 2 and sy=1s_y = 1, so S=diag⁡(2,1)S = \operatorname{diag}(2, 1), and no rotation. Then Σ=SST=diag⁡(4,1)\Sigma = S S^{\mathsf{T}} = \operatorname{diag}(4, 1) and Σ−1=diag⁡(1/4,1)\Sigma^{-1} = \operatorname{diag}(1/4, 1).

  1. At p=(2,0)\mathbf{p} = (2, 0): the quadratic form is pTΣ−1p=4⋅14=1\mathbf{p}^{\mathsf{T}} \Sigma^{-1} \mathbf{p} = 4 \cdot \tfrac{1}{4} = 1.
  2. So G=exp⁡(−12⋅1)=0.6065G = \exp(-\tfrac{1}{2} \cdot 1) = 0.6065.
  3. At p=(0,2)\mathbf{p} = (0, 2): the form is 4⋅1=44 \cdot 1 = 4, so G=exp⁡(−2)=0.1353G = \exp(-2) = 0.1353.
  4. The blob is wide along xx and narrow along yy. Equal distances in the two directions give very different weights.

Now rotate by 90 degrees, so R=(0−110)R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}. Then Σ=Rdiag⁡(4,1)RT=diag⁡(1,4)\Sigma = R \operatorname{diag}(4,1) R^{\mathsf{T}} = \operatorname{diag}(1, 4).

  1. At p=(2,0)\mathbf{p} = (2, 0) the form is 4/1=44 / 1 = 4, so G=exp⁡(−2)=0.1353G = \exp(-2) = 0.1353. This matches step 3 before rotation.
  2. At p=(0,2)\mathbf{p} = (0, 2) the form is 4/4=14 / 4 = 1, so G=0.6065G = 0.6065.

Interpretation: rotation turns the wide axis into the other axis without changing the scales. The blob is parameterised so that gradient descent can change the scales and angle separately.

Example
Blending three blobs along one ray

Three blobs sit along one pixel ray, nearest first, with effective alphas α1=0.8\alpha_1 = 0.8, α2=0.5\alpha_2 = 0.5, α3=0.9\alpha_3 = 0.9, and colours red (1,0,0)(1,0,0), green (0,1,0)(0,1,0), blue (0,0,1)(0,0,1). The background is black.

  1. Blob 1 has transmittance T1=1T_1 = 1. Its contribution is 0.8×(1,0,0)=(0.80,0,0)0.8 \times (1,0,0) = (0.80, 0, 0).
  2. Light left after blob 1 is 1−0.8=0.21 - 0.8 = 0.2.
  3. Blob 2 contributes 0.2×0.5=0.100.2 \times 0.5 = 0.10 times green, so (0,0.10,0)(0, 0.10, 0).
  4. Light left after blob 2 is 0.2×(1−0.5)=0.100.2 \times (1 - 0.5) = 0.10.
  5. Blob 3 contributes 0.10×0.9=0.090.10 \times 0.9 = 0.09 times blue, so (0,0,0.09)(0, 0, 0.09).
  6. Light left after blob 3 is 0.10×0.1=0.010.10 \times 0.1 = 0.01, which goes to the black background.
  7. Check: 0.80+0.10+0.09+0.01=1.000.80 + 0.10 + 0.09 + 0.01 = 1.00. The weights sum to one, as they must.
  8. Pixel colour is (0.80,0.10,0.09)(0.80, 0.10, 0.09).

Interpretation: the nearest blob dominates because it is first in line. Reversing the order would change the colour, which is why the sort is needed.

Example
A frame budget from the paper's results

The paper's Table 1 reports, for Mip-NeRF360 scenes at its evaluation resolution, that the 30K-iteration model renders at 134 FPS and that Mip-NeRF360 itself renders at 0.06 FPS. These are the paper's measurements on its own hardware.

  1. A 30 FPS target allows 1000/30=33.31000 / 30 = 33.3 ms per frame.
  2. At 134 FPS, one frame takes 1000/134=7.51000 / 134 = 7.5 ms. That fits the 30 FPS budget with room to spare.
  3. At 0.06 FPS, one frame takes 1000/0.06=16 6671000 / 0.06 = 16\,667 ms, about 16.7 seconds.
  4. The paper reports the Mip-NeRF360 training time as 48 hours, against 41 minutes 33 seconds for its own 30K model on the same scenes. 48×60=288048 \times 60 = 2880 minutes, and 2880/41.55≈692880 / 41.55 \approx 69, so the training speed-up is roughly 69 times. The paper notes that its 48-hour figure was converted from a 4-GPU run, so treat the ratio as approximate.

Interpretation: the gain is not only faster training. Rendering moves from seconds per frame to real time, which is what makes interactive viewing possible.

Tradeoffs and failure modes

SituationWhat goes wrongBetter choice
Very large scenesPeak GPU memory during training can exceed 20 GB in the paper's unoptimised prototypeReduce the position learning rate, as the paper suggests, or compress the stored model
Little overlap with training viewsFloaters and blobs that were never constrainedAdd regularisation, which the paper says it does not use
Large blobs in view-dependent regionsPopping when the sort order changesBetter culling and antialiasing, both left as future work in the paper
Sparse, unlit or view-limited capturesSpherical harmonic colour fits badly without angular coverageUse a simpler colour model or more views
Need a watertight meshBlobs are not a surfaceExtract a surface from the blobs, or use a mesh-based method
Need a tiny fileMillions of blobs with many parameters eachCompression, or a point-based model with fewer primitives

Gaussian splatting is the right tool when the goal is photorealistic, real-time novel views of a captured scene. It is the wrong tool when the goal is a clean mesh, a small model, or editing that needs a semantic surface.

History

The projection step follows the splatting work of Zwicker and colleagues in 2001, which the paper cites for projecting 3D Gaussians to image space. Point-based rendering, which places small primitives at sampled points and draws them with splats, goes back to earlier graphics research. The paper also builds on the point-based neural rendering of Kopanas and colleagues in 2021.

Radiance fields are the other root. The NeRF paper of Mildenhall and colleagues in 2020 showed that an MLP could represent a scene as a function of position and view direction. The paper evaluates on the Blender synthetic dataset from that work. It also compares against Mip-NeRF360, which it describes as the state of the art in quality, and against InstantNGP and Plenoxels, which it describes as fast methods.

The paper by Kerbl, Kopanas, Leimkühler and Drettakis appeared in ACM Transactions on Graphics in 2023. Its problem was clear from the abstract: no method could render unbounded real scenes at 1080p in real time with state-of-the-art quality. Its answer was the combination of explicit blobs, interleaved density control, and a tile-based rasterizer with a fast sort. The paper's own experiments are the source for the numbers in this lesson.

Check yourself

QuestionRecall: why does the method optimize the scale vector and the quaternion instead of the covariance matrix directly?Show answer

A raw gradient step on Σ\Sigma can produce a matrix that is not positive semi-definite, which describes no ellipsoid. Writing Σ=RSSTRT\Sigma = R S S^{\mathsf{T}} R^{\mathsf{T}} with a positive scale and a unit quaternion keeps every update a valid covariance.

QuestionComputation: a blob has Σ=diag⁡(4,1)\Sigma = \operatorname{diag}(4, 1) and is evaluated at p=(0,2)\mathbf{p} = (0, 2). What is G(p)G(\mathbf{p})?Show answer

The quadratic form is pTΣ−1p=4/1=4\mathbf{p}^{\mathsf{T}}\Sigma^{-1}\mathbf{p} = 4 / 1 = 4, since the yy variance is 1 and py=2p_y = 2. Then G=exp⁡(−12⋅4)=exp⁡(−2)≈0.135G = \exp(-\tfrac{1}{2} \cdot 4) = \exp(-2) \approx 0.135.

QuestionWhy: why must the blobs be sorted by depth before alpha blending?Show answer

The over-operator weights each blob by the light that survives the blobs in front of it. Changing the order changes the transmittance products, so the same blobs in a different order produce a different colour. The sort puts the nearest blob first, which is the physically correct order.

QuestionApplied: a scene has 3 million blobs and each renders in a fixed time. Why does the paper's method stay fast as the number of blobs grows, and what limits it instead?Show answer

Each blob is projected and drawn once per frame, with work proportional to the number of blobs and the pixels they touch, using tile-based sorting on the GPU. The limits are the memory needed to store the blobs and the sort cost, not a per-pixel network evaluation as in NeRF. The paper names GPU memory as the main cost of large scenes.

Sources