Splat Lab — training Gaussian, triangle and convex splats in the browser with BJS + WebGPU

Sooo… yeah, another one. This one is more research than game though, I promise.

Ive been poking at splats on and off for a while now (some of you might remember my GaussianSplattingMaterial questions from earlier this year) and I kept wondering how the newer papers actually stack up against regular 3DGS. Reading the papers is one thing, but I wanted to see them all side by side in BJS… and then I wanted to train them… and then the training needed to not be slow… So here we are.

Introducing Splat Lab!

**→ Have a play:** Splat Lab

**Repo:** GitHub - Pryme8/splat-lab: Train and compare 3D Gaussian, point, triangle and convex splatting in the browser with Babylon.js and WebGPU · GitHub

Basically you give it something (a mesh, a splat file, a point cloud, or a sculpt written in a little SDF language I threw in there) and it turns it into four different kinds of primitives you can flip between:

* **3DGS** — the baseline, drawn with BJS’s own GaussianSplattingMesh

* **Points** — Gaussian point splatting, using the new WebGPU point splatting mode in Babylon 9

* **Triangle** — triangle splatting / Triangle Splatting+

* **Convex** — 3D convex splatting

The untrained versions look rough… thats on purpose, its the starting point the papers optimize from. The fun part is the Train button. It renders a bunch of views of a dense “teacher” version of your source and then optimizes whatever tab you are on against them, with a differentiable rasterizer written from scratch in WGSL compute. All in the browser, nothing leaves your machine, and no build step.

The triangle one is probably my favorite. With the opaque finish on it anneals the triangles until they are fully solid, and then they just draw as a plain old depth tested mesh. No sorting, no blending. Plus it comes out looking kinda painterly which is a fun side effect.

Now the numbers… This is `tests/bench.html` on my 5080 at the default settings (3,000 steps, 256², 64 teacher views):

| | Primitives | Steps/s | Full run |

|—|—|—|—|

| Gaussians | 200k | 137 | ~22 s |

| Triangles | 120k | 280 | ~11 s |

| Convexes | 60k | 77 | ~39 s |

Thats 3-5x faster than the first version (35 / 53 / 25 steps/s). Two fixes did most of that… the sort size never comes back to the CPU anymore (indirect dispatch), and the backward pass now sums its gradients in workgroup memory before writing them out. Before that every warp was just sitting there waiting on 9-17 global compare-exchange round trips per primitive… oof.

Anyways the technical breakdown, Im gonna let claude take the wheel on this part:

-–

### How the training works

* Every source becomes the same set of oriented elements (position, three axes, three radii, color, opacity), and each tab converts those into its own primitive. That’s what the untrained view shows.

* Tile-based differentiable rasterizer in WGSL compute: project → tile counts → prefix sum → key duplication → 4-bit LSD radix sort → per-tile front-to-back compositing.

* Analytic backward pass chained to the 3D parameters: Gaussian mean / scale / rotation, triangle corners, all six convex points, colors and opacities. Adam, a 0.8 L1 + 0.2 L2 loss, and MCMC-style relocation of dead primitives every 250 steps.

* Gradients are checked against central finite differences (`tests/gradcheck.html`): 69/72 Gaussian, 64/66 triangle and 73/84 convex parameters agree within 10%. The misses come from discontinuities: tile edges, opacity cutoffs, points crossing the convex hull.

* The triangle and convex display shaders recompute exactly the same screen-space window as the trainer, so what you trained is what you see.

### BJS + WebGPU things learned the hard way

* On the WebGPU engine, write custom `ShaderMaterial`s in WGSL (`ShaderStore.ShadersStoreWGSL`, `shaderLanguage: WGSL`). Creating *any* GLSL material makes Babylon fetch glslang/twgsl from the CDN, which breaks under a strict CSP.

* Babylon multiplies clip-space y by `yFactor`, so in a WGSL fragment `fragmentInputs.position.xy` is already bottom-up like `gl_FragCoord`. Flipping it again collapsed every triangle into a line.

* Babylon wraps your WGSL `main`, so don’t `return` early from a vertex `main`; use a flag instead.

* If you time GPU work in Chrome, `onSubmittedWorkDone()` and `mapAsync` resolve on polling ticks (2.5–12 ms here), so wall-clock timing of a single pass mostly measures the polling. Timestamp queries give the real numbers.

### Papers

* 3D Gaussian Splatting — Kerbl et al., SIGGRAPH 2023

* Gaussian point splatting — Rijsdijk et al., ACM TOG 2026

* Triangle Splatting / Triangle Splatting+ — Held et al., 2025

* 3D Convex Splatting — Held et al., CVPR 2025

### Where it stands

Research playground, not a production renderer. Color is view-independent (no spherical harmonics yet), there’s no D-SSIM term in the loss, and it has only been benchmarked on one GPU.

-–

That last part is where you all come in! If you have a minute, open Splat Lab benchmark on whatever you have… AMD, Apple, integrated, a potato… and post the numbers here. Id really like to see how it holds up outside of NVIDIA land.

Next on the list is SH for view dependent color, D-SSIM, and exporting the trained results (.ply/.splat for the Gaussians and .glb for the opaque triangles).

Check it out and mess with it when you get a chance! Would love to hear what you think.

Hoookay so I kinda buried the lead in the first post… You can just drag a regular old mesh into Splat Lab and get splats out. And then train them.

“BoomBox → 800k Gaussians, 200k triangles, 100k convexes”

“WaterBottle”

“Avocado”

glb, gltf, obj, stl… it goes through the normal BJS loaders, so whatever BJS can open should work. It flattens everything to world space, samples the surface by area, and the colors come from the material color × the texture × the vertex colors, so textures come through too. The top left in each one is the untrained version, which is just those surface samples turned into primitives. The other three are after hitting Train on each tab.

The triangle one is kinda funny… mesh → splats → train → and with the opaque finish its a mesh again lol. 200k triangles of soup instead of 6k nice ones, buuut it draws as a plain depth tested mesh with no sorting.

Times on my 5080, default settings (3,000 steps, 256²):

| | 3DGS (800k) | Triangles (200k) | Convexes (100k) |

|—|—|—|—|

| BoomBox | 1 min 2 s | 13.5 s | 50 s |

| WaterBottle | 58 s | 12 s | 48 s |

| Avocado | 1 min 30 s | 12.6 s | 1 min 14 s |

The avocado is slower probably cause it fills more of the screen, so more primitives land in each tile.

Now the honest part… The triangles lose the small stuff. The FUNCTION / REPLAY labels on the boombox and the CLIMB HIGHER on the bottle turn into smudges, and the edges get a little crunchy. The Gaussians and convexes hold onto it a lot better. Also the teacher for a mesh is a million surface samples, not an actual render of the mesh, so the supervision is a bit softer than it could be. Thats on the list.

Oh and if you already tried this and the Train button just refused on the 3DGS tab… my bad. A dropped mesh starts at 2M Gaussians and the trainer tops out at 800k, so it was saying no instead of doing anything about it. Now it drops the count to 800k and tells you. Thats live on the demo now.

Models are the BoomBox, WaterBottle and Avocado by Microsoft from the Khronos glTF Sample Assets (CC0): GitHub - KhronosGroup/glTF-Sample-Assets: An assortment of assets that demonstrate features and capabilities of the glTF format · GitHub

**→ Demo:** Splat Lab

Grab a glb and drop it in, Id love to see what weird stuff you all feed it. Check it out and mess with it when you get a chance!

1 Like

very usefull topic thanks for share @Pryme8

same as always

2 Likes

OMG ITS NASIMIASL! Duuuuude where have you been!? Hope all is well.

1 Like

@Pryme8 busy to make some shaders :slight_smile:

1 Like

I wanna see! Post them when you get a chance brother.