splatColour function
A zeroth-band coefficient as the linear channel the engine blends, for a
cloud fitted in space.
Clamped at nought first, because the fit was. The reference rasteriser
returns max(0.5 + C0·c, 0), so a coefficient below −0.5 / C0 never met
a gradient and a trained file is full of them; left negative, such a splat
subtracts light under a premultiplied blend and draws as a dark speck.
Then decoded, when the fit was in sRGB, since this engine blends in
linear light and encodes on the way out: a mid-grey fitted as 0.5 taken as
linear comes back out as about 0.735, which is the whole capture washed
out. The curve is defined on [0, 1], so an sRGB channel clamps at one
too; a linear one keeps its highlights.
Implementation
double splatColour(double coefficient, SplatColourSpace space) {
final channel = math.max(0.0, splatChannel(coefficient));
return switch (space) {
SplatColourSpace.srgb => srgbToLinear(math.min(channel, 1.0)),
SplatColourSpace.linear => channel,
};
}