Gaussian Splatting From Zero · Episode 14
Splat Shaders & Effects
Splat Shaders & Effects is Episode 14 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 .
Splats are rendered by a shader you wrote — which means every trick from Shaders From Zero is on the table. A capture can dissolve like the Marvel snap, ghost into a hologram, or be sliced open to show its cross-section, all by editing the per-splat color, alpha, and position in the same shader that does the covariance projection. This is where the two series shake hands. Pick an effect and watch the planet come apart.
The hook: a splat shader is just a shader
You already have the splat vertex shader (covariance → ellipse) and fragment shader (Gaussian falloff → alpha). Effects slot in at three points, exactly like surface shaders:
| Edit | Where | Buys you |
|---|---|---|
| Color | fragment, before output | tints, grades, hologram cyan, heat |
Alpha / discard | fragment | dissolves, clip cuts, fades, scanlines |
| Position / scale | vertex, on iCenter/iScale | explosions, wind, melt, growth |
The only splat-specific wrinkle: your per-splat "identity" for noise is the splat's
center, not a UV. Hash iCenter for a stable per-splat random.
Dissolve / snap
Give each splat a stable noise value from its position, then erase splats whose noise is below a rising threshold. Splats right at the threshold flare to a hot color — the burning edge. Animate the threshold 0→1 and the capture disintegrates; reverse it and it reassembles:
// vertex: stable per-splat noise → varying
float hash(vec3 p){ return fract(sin(dot(p, vec3(127.1,311.7,74.7))) * 43758.5); }
vNoise = hash(floor(iCenter * 14.0));
// fragment: erase below the threshold, glow at the edge
if (vNoise < uDissolve - 0.06) discard; // gone
float edge = smoothstep(uDissolve, uDissolve - 0.06, vNoise);
color = mix(color, vec3(1.0, 0.5, 0.1) * 3.0, edge); // hot rim
Hologram
The Star Wars look, straight from the shaders series, now wrapping a real capture: a cyan tint, a
fresnel rim that brightens grazing splats, horizontal scanlines
scrolling in time, and a subtle flicker. Because we know each splat's surface
normal (for the planet, normalize(iCenter)) the fresnel is one dot product:
vec3 nrm = normalize(iCenter);
vec3 V = normalize(cameraPosition - iCenter);
float fres = pow(1.0 - max(dot(nrm, V), 0.0), 2.0); // bright at edges
float scan = 0.6 + 0.4 * sin(iCenter.y * 60.0 - uTime * 6.0);
vec3 holo = vec3(0.3, 0.9, 1.0) * (scan + fres * 1.5);
Clip plane
A moving half-space test turns the capture into a live cross-section: discard every splat above a sweeping plane, and glow the splats right at the cut. Because our planet is a hollow shell of splats, slicing it reveals the inner back surface — the splat equivalent of a CAD section view, useful for inspecting a capture's internal junk:
if (iCenter.y > uClipY) discard; // cut the top off
float band = smoothstep(0.12, 0.0, uClipY - iCenter.y);
color = mix(color, vec3(0.2, 1.0, 0.8), band); // glowing cut line
The catch worth knowing: effects that move splats (explosions, melts) change their depth, so your back-to-front sort goes stale and the blending can flicker. For big motion, re-sort more often or accept the small error. Color/alpha-only effects (dissolve, hologram, clip) keep positions put, so the sort stays valid — which is why those three are the safe, popular ones.
Common pitfalls
- Dissolve noise crawls when you orbit. You hashed a screen-space or
view-dependent value. Hash the world-space
iCenterso the pattern is locked to the object. - Hologram fresnel looks flat. No per-splat normal. For a real capture you don't have clean normals — approximate from the splat's shortest covariance axis, or bake one.
- Moving-splat effects flicker. Stale depth sort after you displaced positions. Re-sort, or keep effects to color/alpha.
- Edge glow invisible. Additive/premultiplied blending already sums brightness — push the glow color above 1.0 (HDR) so it reads against the lit splats.
Exercises
- Make the dissolve directional: bias the threshold by
iCenter.yso the capture dissolves bottom-to-top instead of uniformly. - Add a second clip plane and keep only the splats between them — a movable slab view.
- Combine: hologram tint plus a slow dissolve, for a "materializing transmission" intro to a capture on a website.
- Drive a gentle wind by offsetting
iCenter.xzwithsin(uTime + iCenter.y)in the vertex shader — and watch the sort struggle, proving the blockquote's point.
What's next
Episode 15 — Animated & 4D Gaussian Splats. The one everyone asks for. So far "animation" meant a shader effect on a static capture. Next we make the splats themselves move over time — volumetric video — with a timeline you can scrub, and the real story of PLY sequences, 4D-GS, and what actually plays them back.