Spz Gaussian Loader
Concrete GaussianLoader for Niantic's SPZ wire format — the de-facto Gaussian-splat exchange format. Spec: https://github.com/nianticlabs/spz. Decoder matches the reference src/cc/load-spz.cc for versions 1, 2, and 3.
Wire layout: 16-byte header (NGSP magic, version, numPoints, shDegree, fractionalBits, flags, reserved) followed by a gzipped per-splat body. Body order: positions (9 B each, int24 fixed-point), alpha (1 B), colour (3 B DC SH), scale (3 B log), rotation (3 B v1/v2 or 4 B v3 smallest-three), optional higher SH bands.
V3 differences from v1/v2: scale packs to log-domain via (g.scale + 10) * 16 (vs. v1's (g.scale + 127.5) * 16), and rotation uses smallest-three quaternion encoding (4 B holding three 10-bit fields + a 2-bit largest-index, vs. v1's 3 B XYZ + W from sqrt). Using v1 formulas on v3 data yields ~8× oversized splats with random orientation.
Parameters
Optional global RTC center applied when the payload omits one. Production SPZ writers typically embed the RTC center in the surrounding 3D-Tiles content envelope; this constructor parameter is the fallback for stand-alone .spz.
Per-attribute skip flags. Default decodes every field; pass SpzDecodeOptions.ROUND_SPLAT when the renderer only needs centres + scales + rgba.
Constructors
Functions
Parse bytes into a GaussianPayload. Called only after supports returns true. May throw to signal a malformed payload — the layer treats throws as a tile load failure (the tile transitions to FAILED and stays without content).