Splats · function

browserWebpDecoder

The ordinary decoder: @driftengine/core's exact texel read.

Explained in Gaussian splats.

function browserWebpDecoder(): WebpDecoder
import { browserWebpDecoder } from '@driftengine/splats';

In depth

A thin forward, and the reason it is not implemented here is worth reading before anybody inlines it. Every browser API that hands back an image's pixels without a GPU premultiplies on the way through — a 2D canvas by storing premultiplied, WebCodecs by decoding a WebP with alpha to a premultiplied BGRA frame — so every RGB value comes back through round(round(c * a / 255) * 255 / a). On the committed fixture that is 3 of 255 out on sh0.webp, whose RGB are codebook indices and whose alpha is the opacity: an index several entries away wherever a Gaussian is transparent. createImageTexelDecoder reads the same file exactly, and it lives in core because it is raw WebGL and AGENTS.md allows that only there.

A consumer with its own decoder passes it instead; that is what the parameter is for.