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, as the capture stores them: display values.
More

A capture is trained against photographs, so its spherical-harmonic DC term reproduces their pixels when drawn as it is, which is what every reference viewer does. This engine composes in linear light and grades once at the end, so the shader decodes the colour (after the view-dependent term) and the frame's encode gives it back. Until 4.13.0 these were read as linear, which drew the same under the old outputTransform: 'none' default and a washed-out cloud under srgb. What would make it wrong is a capture whose tool wrote linear radiance into the DC term, which would draw too dark rather than subtly wrong.

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.