Splats · function

packSplats

Turn a source into two texels per splat, and compute the capture's bounds while the loop is open.

Explained in Gaussian splats.

function packSplats(source: SplatSource): SplatData
import { packSplats } from '@driftengine/splats';

Parameters

ParameterTypeDescription
sourceSplatSource

In depth

Texel 0 is the three position floats reinterpreted as uint32 plus the colour as RGBA8. Texel 1 is the six unique terms of the 3x3 covariance as three half pairs, with the fourth component reserved and written zero.

The covariance is computed here and never again. It is fixed for the lifetime of a capture, so evaluating it per splat per frame would cost a quaternion-to-matrix and two 3x3 multiplies for a value that cannot change. What that gives up is six halves of precision against the source's floats; what would make it wrong is a capture whose splats are animated, which is not a thing this format can express.