Skip to content
All notes

Notes · 2026-11-02 · 14 min

Twenty-one exports, one grey ghost

I tried to put my own 4D Gaussian Splatting model into a WebGPU viewer. Twenty-one exports later it still renders as a pale ghost, while the vendor's own file of the same scene renders perfectly. This is the honest record of what matched, what did not, and what I would do differently.

4DGSONNXWebGPUDebugging

Visionary is an open platform that renders Gaussian Splatting in the browser with WebGPU. Its README lists 4DGS among the supported variants, and the repository ships a dedicated export guide for 4DGaussians. So when my own 4D model needed a web viewer, this looked like the shortest path: export the trained checkpoint to ONNX, drop it in, done.

It was not done. This note is the record of that attempt, because the failure was more instructive than the plan.

What the export is supposed to do

A 4DGS model is a set of gaussians plus a small network that displaces them over time. Visionary does not store a frame per timestamp. It runs that network once per displayed frame inside the browser and draws whatever gaussians come out. The contract is three tensors: gaussian_f16, color_sh and num_points.

The vendor's exporter, onnx-export/ONNXExample-4dgs/onnx_template.py, wraps a trained checkpoint into exactly that. It is about a thousand lines and it loads point_cloud.ply, deformation.pth and cfg_args from the run directory.

What it took to make it run at all

Three things were needed before the file would even load:

Pin the torch version. Exporting with torch 2.15 produced a graph that the WebGPU execution provider refused, with WebGPU session creation failed with both path and buffer approaches. Exporting the same checkpoint with torch 2.5.1 and opset 17 loaded immediately. The newer exporter emits a different graph; the WebGPU backend does not accept it.

Replace every cuda with cpu. The script hardcodes map_location="cuda" and .to("cuda") in three places. On a Mac those lines fail before anything else happens.

Invent the grid_aabb. The exporter reads args.grid_aabb out of cfg_args — a value that only exists if you patched train.py before training, as their guide instructs. I trained before reading that guide, so the value was missing and I substituted the bounding box of the trained point cloud. The export accepted it and the deformation network loads, but this is the first place where my file quietly differs from a canonical one.

What the file contains

Once exported, the numbers can be checked directly with onnxruntime on the CPU. The signature is

`

input time float32 [1]

output gaussian_f16 float16 [N, 10]

output color_sh float16 [N, 48]

output num_points int32 [1]

`

gaussian_f16 is not position, scale and rotation. It is position (3), opacity (1) and the six independent entries of the 3×3 covariance matrix. color_sh is 48 channels: three DC coefficients followed by 45 higher-order ones.

Two checks convinced me the export was faithful to the model. At t = 0 the exported positions differ from the source PLY by a median of 1.7 cm, so the network is displacing the right points rather than inventing them. And the same scene as a static PLY renders in full colour in the same viewer, so the colour values themselves are sound.

Where it went wrong

The file loads. The editor reports Model added · 60,783 points, sets the colour mode, and starts the animation. The viewport then shows a pale grey ghost with faint streaks — the right silhouette, the wrong surface.

Twenty-one variants followed. The useful ones:

The 4,000,000-row buffer. The exporter pads both outputs to a fixed capacity of four million points. That is 230 MB of fp16 per frame, which is why the first working version ran at roughly one frame every three seconds. Setting the capacity to the real count cut the traffic by about 66 times and made playback usable.

The colour mode is decided by name and shape. The loader first inspects the colour output's last dimension: 48 means spherical harmonics, 3 or 4 means direct RGB. If it cannot read the shape, it falls back to names, and any output called color_sh is forced to 48 channels. My three-channel experiment was still called color_sh, so it was read as 48 channels and produced purple. Renaming it to rgb16 with a concrete [N, 3] shape made the loader report color mode: rgb (3 channels) — the first time it acknowledged a colour block of mine at all.

The vendor's own example is the same scene. The example assets include gaussians4d.onnx, which turns out to be the same cut_roasted_beef capture, 95,028 points, and it renders in full colour on the same machine. That single fact reframed everything: the pipeline works for this content, so the difference is entirely inside my export.

And yet the statistics match. Measured at t = 0.5, the official file and mine agree on every aggregate I could think of: opacity median 0.617 against 0.679, covariance median 3.7 × 10⁻³ against 6.0 × 10⁻³, colour carried in the DC channels with the other 45 zeroed, positions unscaled and uncentred. I rebuilt my file to reproduce that structure exactly. It still ghosts.

What I think is left

When every aggregate matches and the image still differs, the difference is in something aggregates do not show: the per-point correspondence between position, opacity and covariance, or the way the graph hands the deformation output to the renderer. Both live inside the vendor's shaders and their own export run, neither of which is documented.

A search for precedent turned up nothing. The repository has ten issues and none mention colour. All thirty forks carry a byte-identical copy of the exporter, so nobody has published a modified one. The Chinese tutorials are translations of the official guide. As far as I can tell, no one has publicly shown a self-trained 4DGS model rendering correctly in this viewer.

What I would do differently

Read the renderer before writing the exporter. I spent fifteen variants guessing at one parameter at a time — scale, then colour, then padding — when the loader's own source states plainly how it picks a colour mode. Ten minutes of reading would have replaced ten uploads.

Get a known-good file first, then diff. The moment I had the vendor's example of the same scene, the search space collapsed from "what is wrong with my model" to "what is different between these two files". I should have started there.

Treat a fixed-size output buffer as a performance decision, not a detail. Four million padded rows is invisible in the file listing and fatal in the frame budget.

Where this leaves the project

The site shows the rendered video, which is the 4DGaussians renderer's own output and looks the way the model is supposed to look. The interactive attempt stays in the lab, labelled as a prototype, with the export pipeline and this record beside it.

The pipeline itself is worth keeping: a working 4dgs-pack.py and 4dgs-read.py, a documented ONNX export for 4DGS on Apple silicon, and a list of the specific traps — torch version, CUDA paths, missing AABB, padded buffers, name-driven colour modes — that cost the most time. If someone else starts this, they can skip the first fifteen attempts.