Gaussian Splatting From Zero · Episode 17
Training, Deep
Training, Deep is Episode 17 of Gaussian Splatting From Zero, a MasterAllArts free interactive lesson for artists learning creative 3D on the web.
Part of the MasterAllArts Creative 3D Roadmap .
You've rendered millions of splats — but where do their positions, colors, and shapes come from? Training. A capture isn't authored; it's optimized: start with a rough guess, render it, measure how wrong it is against the photos, and nudge every splat's parameters downhill to make it less wrong — millions of times. This episode runs that loop live, in 2D, in your browser. The blobs below start as random noise and learn to become a target image by gradient descent — the exact algorithm behind every 3DGS capture, small enough to watch.
The optimization loop, in five steps
Every Gaussian splat scene — the bicycle, the garden, your phone capture — is produced by this loop. The demo is a 2D version of it, but the steps are identical to the real thing:
- Initialize. Place Gaussians at a rough guess. Real 3DGS seeds them at the SfM point cloud (Episode 09); the demo scatters them randomly and warm-starts each color from the target underneath it.
- Render. Rasterize the current Gaussians to an image — the differentiable splatting you built in Season 1.
- Loss. Compare the render to the ground truth (the photo, or here the target
image):
loss = mean((render − target)²). One number for "how wrong." - Backprop. Compute, for every parameter of every Gaussian, which way to nudge it to shrink the loss — the gradient. Because the renderer is differentiable, this is exact.
- Step & adapt. Move each parameter a little down its gradient. Periodically densify (split Gaussians where detail is missing) and prune (delete invisible ones). Repeat ~30,000 times.
Why "differentiable rasterization" is the whole trick
The 2020 NeRF idea needed a neural network to be differentiable. The 2023 breakthrough was
realizing that splatting itself is differentiable — you can write down, in closed
form, how the output image changes when you nudge a Gaussian's position, color, or covariance.
No network required. For a splat contributing c·G(p) at pixel p, the
gradients are textbook calculus:
// per pixel in the splat's footprint, with residual = render − target:
grad_color += 2 * residual * G; // brighten/darken
grad_position += 2 * (residual·color) * G * (p − pos) / s²; // slide toward error
grad_size += 2 * (residual·color) * G * |p − pos|² / s³; // grow/shrink
Sum those over the pixels each splat touches, take a small step against them, and the splats flow toward the image. That's it. The demo computes exactly these gradients every frame — open the console-free HUD and watch the loss fall.
Adaptive density control: where the million splats come from
You don't pick the splat count — training does. Toggle adaptive density and watch the count change:
- Densify. Where the image is still wrong and a splat's position-gradient is large (it's being "pulled" hard), the splat is split into two and they specialize. This is how a scene grows from a sparse point cloud to millions of Gaussians, concentrating detail where the image needs it.
- Prune. Splats that have gone nearly transparent or tiny contribute nothing and are deleted, keeping the model lean.
- Opacity reset. Real 3DGS periodically knocks all opacities down to force the optimizer to re-justify every splat — a trick to escape bad local minima. (We skip it here.)
Turn adaptive density off and the fixed blobs still improve, but they can't grow detail where they're too sparse — you can see the ceiling of a fixed budget.
What the real trainer adds
| The demo | Real 3DGS |
|---|---|
| 2D isotropic blobs, position+color+size | 3D anisotropic Gaussians: + rotation, opacity, degree-3 SH |
| Plain SGD, one image | Adam optimizer, hundreds of photos, scheduled learning rates |
| Additive compositing | Sorted "over" compositing, fully differentiated through the sort |
| ~30s to converge | Minutes to an hour on a GPU; CUDA-fused rasterizer |
The conceptual leap is small and worth stating plainly: a 3D capture is just this 2D toy, run against many photos at once, in 3D. Render, compare, nudge, adapt. Everything else is engineering to make it fast and stable.
Common pitfalls (training, for real)
- Loss explodes / NaNs. Learning rate too high, or a splat's size went to zero
(the
1/s²blows up). Clamp sizes; lower the position/size learning rates. - Blurry, won't sharpen. Densification off or too conservative — no new splats where detail is needed. Or sizes stuck large.
- Floaters in the result. Splats that fit one view's error by sitting in empty space (Episode 09). Opacity reset + pruning + more views fix it.
- Slow to converge. Bad initialization. SfM points (or a warm color start, as here) beat pure random by a mile.
Exercises
- Turn adaptive density off and note the final loss; turn it on and compare. The gap is the value of growing splats where the image needs them.
- Crank the speed and watch the loss curve — it falls fast, then crawls. That long tail is why real training takes so many iterations for the last bit of sharpness.
- Switch the view to "splat centers" and watch them migrate toward the image's busy regions — the optimizer allocating capacity where the error lives.
What's next
Episode 18 — Dynamic-Scene Research. Training a static scene is solved; training a moving one is the frontier. We map how 4D actually works under the hood — deformation fields, 4D-Rotor, per-Gaussian time — and visualize a canonical scene being warped through time by a learned deformation.