Splats · function
readSplat
Read a .splat capture.
Explained in Gaussian splats.
function readSplat(buffer: ArrayBuffer): SplatDataimport { readSplat } from '@driftengine/splats';Parameters
| Parameter | Type | Description |
|---|---|---|
buffer | ArrayBuffer |
In depth
The one thing worth knowing is the quaternion's encoding. Rotation arrives as four bytes and
comes back as (b - 128) / 128, so a byte of 128 is zero and the representable range is roughly
−1 to +0.9922. packSplats normalises what it is handed, which is what makes that asymmetry
harmless: the quantised quaternion is a hair off unit length and the normalisation absorbs it.
The file stores wxyz and SplatSource takes xyzw, so the reorder happens here, in the one
place the file's own order is on screen. Getting it wrong does not produce a refusal — it
produces a capture whose every splat is rotated to somewhere else, which reads as a smear.
Colour is already eight-bit and already linear, so it divides by 255 and nothing else: there
is no logistic and no exponential here, unlike the .ply reader. That asymmetry is the format's
rather than a choice, and packSplats takes linear values from both.