Builtin Library
- ..
- README.md1.1 KB
- properties.yaml393 B
- shader.wgsl3.0 KB
README.md
lut post-process shader
Colour grading through a lookup table. pp.add(name, "lut", { texture = ... })
registers it; @builtin::modules.lut builds, imports and installs the tables it
reads.
lut_texture is a LUT strip: an N-entry colour cube laid out as one row of N
square tiles, so the image measures N*N wide by N tall. Tile b holds the
plane of constant blue index, red runs across a tile and green runs down it. N
comes from the texture's own height, so this one shader serves a 16-, 32- or
64-entry cube.
The eight lattice entries around a colour are fetched with textureLoad at exact
texel coordinates and interpolated in the shader. That makes the result
independent of the texture's filter and wrap mode, and each blue plane is read
from its own tile.
A texture whose shape is not a strip — including the 1×1 fallback bound when the effect has no table — returns the frame untouched, so adding the effect before its table exists changes nothing.
| Property | Meaning |
|---|---|
amount | 0 = the ungraded frame, 1 = the table's answer. |
lut_texture | The strip. |