Splats · interface

SplatSource

A capture as a reader hands it over: linear values, one array per attribute.

Explained in Gaussian splats.

interface SplatSource
import type { SplatSource } from '@driftengine/splats';

In depth

Linear, and that boundary is load-bearing. A .ply from a training run stores scale as its logarithm and opacity as its logit, and undoing both is the reader's job rather than this one's. Getting the boundary wrong produces a capture that is either invisible or a solid block, and both have been reported against other viewers — because both look like a rendering fault.

Properties

NameTypeDescription
countreadonlynumber
positionsreadonlyFloat32ArrayThree per splat, in the capture's own space.
scalesreadonlyFloat32ArrayThree per splat: the Gaussian's standard deviation along each of its own axes, in metres.
rotationsreadonlyFloat32ArrayFour per splat, xyzw, normalised here rather than trusted.
More

Both file formats store wxyz and this does not, which is a deliberate seam: xyzw is what gl-matrix uses and what every other quaternion in this engine is, so a consumer building a source by hand is not asked to learn a second convention for one type. Each reader reorders on the way in, in one line, at the point where the file's order is already on screen.

colorsreadonlyFloat32ArrayThree per splat, 0 to 1, linear.
More

Not sRGB-decoded, which is what every reference viewer does and is also what is correct here: a capture's colour comes from a spherical-harmonic DC term, which is linear radiance, and this engine shades and composites in linear and grades once at the end. What would make it wrong is a capture authored by a tool that baked a display transform into the DC term — which produces a washed-out cloud, not a subtly wrong one.

opacitiesreadonlyFloat32ArrayOne per splat, 0 to 1, already through the logistic if the format stored a logit.
sh1readonlyoptionalFloat32ArrayThe l=1 spherical-harmonic band, nine per splat, or absent for a capture that has none.
More

Interleaved by basis function and then by channel — Y(1,−1).rgb, Y(1,0).rgb, Y(1,1).rgb — which is not how a .ply stores them. That file is channel-major, all fifteen of red before all fifteen of green, and the reader transposes on the way in for the reason every other reordering in this package happens there: the file's own order is on screen at exactly one place, and a shader that had to know it would be a second copy of a convention nothing checks.

Raw coefficients, signed, in the same units the training run wrote — the band constant is the shader's to apply, like SH_C0 is the reader's for the DC term.