</> Live Procedural Splat Script — Edit JavaScript or Paste AI-Generated Scene Code
How handwritten 3D Gaussian Splatting works (EWA covariance, wet mirrors & SplatKit API)
Why procedural Gaussian splats look painterly where procedural polygons look sterile
Most 3D Gaussian Splatting (3DGS) pipelines treat splats strictly as a photogrammetry capture format: photograph a real street from 150 viewpoints, run Structure-from-Motion, and optimize millions of 3D Gaussians. Conversely, code-generated Three.js scenes usually assemble polygon boxes and cylinders whose razor-sharp triangle silhouettes and UV-free planes immediately read as synthetic programmer art.
Inspired by Eddie Lee's nocturnal Three.js + real-time 3DGS rain studies (highlighted by CF Changfeng), this studio flips both sides: analytic primitives and noise fields provide the invisible skeleton, while ~135,000 anisotropic 3D Gaussian surfels act as physical brushstrokes:
- Exact EWA 3D-to-2D Covariance Projection: Each surfel stores world center
μ, tangent scales(s_x, s_y, s_z)with thin normal thicknesss_z ≪ s_x, and unit quaternionqwhose third column encodes the surface normal. Every frame, the vertex shader formsΣ_3D = R S Sᵀ Rᵀ, projectsΣ_2D = J W Σ_3D Wᵀ Jᵀ + εIthrough the perspective JacobianJ, and aligns each instanced quad to the exact 2D eigenvectors(√λ₁ v₁, √λ₂ v₂). - Zero-Raytrace 3D Wet-Puddle Reflections: Instead of screen-space reflection artifacts that vanish at grazing angles, bright neon, streetlight, and car splats spawn mirrored 3D Gaussians across the puddle plane
y = 0with flipped quaternion pitch/roll and horizontally broadened covariance proportional to height and asphalt roughness—yielding parallax-accurate wet reflections at 60 fps. - 1-Millisecond 16-Bit Counting Depth Sort: All splat attributes remain resident in GPU
RGBA32Ftextures; the CPU runs a single-pass 65,536-bucket counting sort over view-space depth and uploads only a compactR32UIindex map. - 35mm CineStill 800T Emulsion Halation & Pixel Grid: Rendering into a sub-native HDR framebuffer scatters bright highlights through a red-orange remjet-free halation kernel before applying tungsten film curves (or 16-bit Bayer palette quantization) and dual-scale silver-halide grain.
SplatKit Procedural Authoring Primitives
| Primitive / Pass | What it generates | Typical splat budget |
|---|---|---|
kit.surfaceQuad / kit.box |
Jittered tangent surfels with 3D FBM grime, mortar joints, or custom colorFn(x,y,z,u,v) callbacks plus analytic shadow-occluder AABBs. |
2,000 – 45,000 splats |
kit.corrugatedAwning / kit.cylinder |
Analytic sinusoidal tin roofs (with exact derivative normals and rust streaks), pipes, utility poles, and alloy wheels. | 1,500 – 12,000 splats |
kit.neonTube & kit.lightShaft |
HDR emissive glass cores + atmospheric bloom halos (with 60 Hz transformer buzz) and volumetric sodium mist cones. | 400 – 2,500 splats |
kit.rainField & kit.puddleRipples |
Velocity-aligned falling rain streaks and expanding concentric puddle rings animated at 60 fps in the vertex shader. | 2,500 – 4,500 splats |
kit.bakeLighting |
Bakes hemisphere AO, jittered soft-shadow point/spot lights, Blinn-Phong wet sheen, and spawns mirrored puddle splats across y = 0. |
+15,000 – 26,000 mirror splats |
Read the companion post · Optical Lens Bench · Lighting a wine glass with one lamp · Inspired by Eddie Lee's heavy rain in LA (via CF Changfeng) and Mert Cobanov's pixelart-gaussiansplat.