Gaussian Splatting From Zero · Episode 01
What Is a Gaussian Splat?
What Is a Gaussian Splat? is Episode 01 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 .
A Gaussian splat is a fuzzy, colored, oriented blob of light floating in 3D space. Take a few million of them, give each one a position, a color, a transparency, and a little squashed-ellipsoid shape, sort them back-to-front, and blend them over each other — and you get a photograph you can fly through. No triangles, no surfaces, no UV maps. Just blobs. That's the whole idea, and it currently produces the most realistic real-time 3D captures we know how to make.
This series builds a Gaussian splat renderer from scratch in plain Three.js. By the end of Season 1 you'll have written the covariance projection, the depth sort, and the spherical-harmonic color yourself. But everything starts here, with the most boring possible version: a cloud of points. Orbit the demo below with your mouse. Then we'll find out why points alone aren't enough.
Where splats come from: NeRF, then the 2023 earthquake
For a decade, turning photos into 3D meant photogrammetry: find matching features across images, triangulate a point cloud, then drape a textured mesh over it. It works, but hair, foliage, glass, and reflections — anything that isn't a clean opaque surface — come out as garbage.
In 2020, NeRF (Neural Radiance Fields) changed the target. Instead of a mesh, NeRF trains a neural network to answer one question: "standing at this point, looking in this direction, what color and how much fog do I see?" Query it along a ray, accumulate, and you get a photoreal image from any angle. The catch: it was a neural network, so rendering one frame took seconds.
Then in 2023, a SIGGRAPH paper — "3D Gaussian Splatting for Real-Time Radiance Field Rendering" — kept NeRF's "store the light field, not the surface" idea but threw out the neural network. They replaced it with millions of explicit 3D Gaussians you can rasterize directly on a GPU. Same realism, but 100+ fps instead of one frame every few seconds. That's the technique this series teaches. It went from paper to shipping in PlayCanvas, Unreal, and phone apps in well under two years.
"Gaussian" is just the name of the blob's shape — the smooth bell curve, brightest in the center and fading to nothing at the edges. "Splat" is the verb: you splat each 3D blob onto the screen like a paintball. Surface Splatting as a rendering idea dates to 2001; the 2023 paper made it trainable and photoreal.
The five numbers that define one splat
Strip away the marketing and a single Gaussian splat is just a small bundle of numbers. Memorize this table — it's the entire data model, and the next seven episodes are each about turning one row into pixels:
| Property | Type | What it controls | Episode |
|---|---|---|---|
position | vec3 | Where the blob's center sits in 3D space | 01 (today) |
color | vec3 (or SH) | Its base RGB — later, a function of view direction | 04, 06 |
opacity | float | How solid vs see-through it is | 04 |
scale | vec3 | The length of its three axes — how stretched the ellipsoid is | 03 |
rotation | vec4 (quat) | Which way the ellipsoid is tilted | 03 |
That's 14 floats per splat (3 + 3 + 1 + 3 + 4) in the simplest case — more once color becomes view-dependent in Episode 06. A real capture has a few million splats, so we're talking tens of megabytes of these little bundles. Our job as renderer-writers is to take that pile of numbers and blend it into an image, sixty times a second.
Today we only use the first two rows: position and color.
Ignore size, shape, and opacity — render each splat as a single point. That's
literally how a real capture is initialized: the 2023 pipeline starts from a sparse
photogrammetry point cloud and grows splats out of it. So a point cloud isn't a toy
detour; it's frame zero of the real thing.
Rendering a point cloud with THREE.Points
Three.js has a built-in primitive for exactly this: THREE.Points. You
hand it a BufferGeometry with a position attribute (and here,
a color attribute), and it draws one GL point per vertex. We give it a
tiny ShaderMaterial so we control the point size ourselves:
// Build the geometry: 60k random points with per-point color
const N = 60000;
const positions = new Float32Array(N * 3);
const colors = new Float32Array(N * 3);
// ... fill them procedurally (a nebula-ish cloud) ...
const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(positions, 3));
geo.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const material = new THREE.ShaderMaterial({
uniforms: { uSize: { value: 6 }, uMode: { value: 0 } },
vertexShader, fragmentShader,
transparent: true,
});
const points = new THREE.Points(geo, material);
scene.add(points);
The interesting bits are in the shaders. The vertex shader sets a special built-in
output, gl_PointSize, which tells the GPU how many pixels wide to draw the
point sprite:
// VERTEX SHADER
uniform float uSize;
uniform int uMode;
attribute vec3 color; // our per-point color attribute
varying vec3 vColor;
void main() {
vColor = color;
vec4 mv = modelViewMatrix * vec4(position, 1.0);
if (uMode == 0) {
gl_PointSize = 1.0; // stage 1: one hard pixel
} else if (uMode == 3) {
gl_PointSize = uSize * 80.0 / -mv.z; // stage 4: shrink with distance
} else {
gl_PointSize = uSize; // stages 2,3,5: constant pixels
}
gl_Position = projectionMatrix * mv;
}
And the fragment shader, where gl_PointCoord gives us a 0→1 coordinate
inside each little square sprite — which we can use to carve the square into a
circle:
// FRAGMENT SHADER
uniform int uMode;
varying vec3 vColor;
void main() {
// stages 3,4,5: discard the corners to make the square round
if (uMode >= 2) {
float d = length(gl_PointCoord - 0.5);
if (d > 0.5) discard;
}
gl_FragColor = vec4(vColor, 1.0);
}
Five stages, one material. Step through them in the demo:
Stage 1 — 1-pixel points
The rawest view. Every splat is a single pixel. The cloud looks sparse and sparkly, and as you orbit it aliases — points blink in and out as they cross pixel boundaries. This is what a freshly-initialized capture looks like before any training. It's also a useful debugging view forever: if your splats are in the wrong place, drop to 1px points and you'll see the skeleton instantly.
Stage 2 — Sized squares
Crank gl_PointSize up with the slider. Now you can see the cloud's
shape — but you can also see the dirty secret of GL points: they're
squares. Every "point" is an axis-aligned quad that always faces the screen.
Useful, ugly, and the reason nobody ships points as a final look.
Stage 3 — Round points
Two lines in the fragment shader turn squares into circles: measure the distance
from the sprite's center and discard anything past the edge. Better! But
notice the circles are hard-edged and all exactly the same size,
whether they're near or far. A blob ten meters away is drawn as big as one right in
front of you. That's wrong, and it's the next fix.
Stage 4 — Depth-sized points
Real things get smaller with distance. We scale gl_PointSize by
1.0 / -mv.z — one over the view-space depth — so far points shrink and
near points grow. Suddenly the cloud has volume. Orbit it: the front feels
close, the back feels far. This perspective sizing is the first hint of how a 2D
sprite can stand in for a 3D shape.
Stage 5 — It's just data
Same render, but sit with what's on screen: every dot is one row of our table — a position and a color, nothing more. There's no lighting here, no shadows, no material. The color is just painted on. That's a profound and slightly unsettling fact about splatting: the renderer never computes how light bounces. It replays light that was already measured. A splat doesn't know it's part of a red apple; it just knows it's a reddish blob at a spot in space.
Why points aren't enough — the cliff
Orbit slowly and look hard at Stage 4. Three things are clearly broken, and each one is an episode:
- Hard edges. Real captures are soft. Each blob should fade out smoothly toward its rim — a Gaussian falloff — so overlapping blobs melt together instead of tiling like confetti. That's Episode 02.
- Round only. A flat wall is best represented by flat, wide, squashed blobs lying along it — not spheres. Each splat needs a 3-axis scale and a rotation: an ellipsoid. Projecting that ellipsoid to the screen is the math at the heart of splatting. That's Episode 03.
- Opaque. These points are 100% solid, drawn in whatever order the array happens to be in. Real splats are semi-transparent and must be blended back-to-front or the image falls apart into "popcorn." That's Episodes 04 and 05.
Fix those and the same 60,000 dots stop looking like a screensaver and start looking like a thing that was photographed. That's the whole season.
Common first-day pitfalls
- Nothing renders.
THREE.Pointsneeds apositionattribute, and your camera has to actually be pointing at the cloud. Drop to Stage 1 and zoom out — points are easy to fly past without noticing. - Giant blocky squares. You forgot the round-point
discard, or you setgl_PointSizeto something huge. Most GPUs also clamp point size (often around 64px) and silently ignore larger values — don't build anything important on big points. - Colors look washed out or too dark. Color management. Set
renderer.outputColorSpace = THREE.SRGBColorSpaceand decide on purpose whether your color data is linear or sRGB. We'll fight this properly in Episode 04. - Points don't shrink with distance. You used a constant
gl_PointSize. Perspective sizing needs the view-space depth (-mv.z) in the divisor, as in Stage 4. - Everything aliases / flickers. That's inherent to 1px points and is exactly why we move to soft, sized splats next episode. It's not a bug in your code.
Exercises
- In Stage 3, replace the hard
discardwith a soft alpha:gl_FragColor.a = 1.0 - smoothstep(0.45, 0.5, d)and settransparent: true. You've just invented a crude version of next episode's splat — what looks better, what looks worse? - Add a third attribute,
opacity(afloatper point), and multiply it intogl_FragColor.a. Randomize it per point. This is row 3 of the table, one episode early. - Change the procedural generator (top of the demo script) to sample points on the surface of a sphere instead of a cloud. Notice you can't tell it's a solid sphere — because points have no surface. Hold that thought for Episode 03.
What's next
Episode 02 — From Points to Splats. We replace each hard point with
a camera-facing quad carrying a smooth Gaussian exp() falloff, switch to
instanced rendering so we can afford millions of them, and turn on additive blending.
The screensaver becomes a nebula. It's the single most satisfying ten-line upgrade in
the series.