3D Gaussian Splatting in a Weekend

· math ai devtools · Source ↗

TLDR

  • Builds a ~1000-line C++/OpenGL 3DGS renderer from scratch, covering splat loading, spherical harmonics, covariance reparameterization, and real-time rendering.

Key Takeaways

  • Each Gaussian splat stores centroid, opacity, scale (log-space), rotation (quaternion), and 48 spherical harmonic floats for view-dependent color.
  • No Model matrix: world-space centroids skip straight to View and projection transforms, unlike standard rasterization pipelines.
  • Covariance is stored as scale + rotation rather than a full 3x3 matrix to guarantee positive semi-definiteness during training backprop.
  • Spherical harmonics enable per-splat view-dependent color; a +0.5 bias on SH output keeps zero-centered coefficients near mid-grey.
  • The renderer targets ~200k splats using a tomatoes scene from Supersplat; code is portable to WebGPU, Metal, or DirectX.

Hacker News Comment Review

  • The single comment asks how 3DGS differs from Lidar or KinectV2 point clouds, pointing to a real conceptual gap: 3DGS splats are optimized probability distributions with orientation, scale, opacity, and view-dependent color, not raw XYZ samples.

Original | Discuss on HN