API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classLutFilter
A Filter that maps every pixel of the input through a Look-Up Table texture. Two storage modes: - **RGB 1D LUT** (`N×1`, default `N=256`): three independent per-channel curves - `R' = lut(src.r).r`, `G' = lut(src.g).g`, `B' = lut(src.b).b`, alpha untouched. Used for levels/curves-style grading, colour ramps, posterisation and animated recolouring. - **3D LUT** (`N²×N` unwrapped cube): indexed by the full source RGB with trilinear interpolation between slices. Used for cinematic colour grading, tone mapping, film stock emulation, accessibility filters (color-blindness simulation), and similar standard colour-pipeline tasks. `N=17` matches DaVinci/OBS export defaults. A 1D LUT cannot express cross-channel mixing (that is what the 3D mode is for), and it is not an indexed-colour palette lookup: each channel only ever sees its own curve. ## Quick start ```ts // Color-graded look from a 17³ LUT exported by your DCC/grading tool: const lut = LutFilter.fromImage(myLutImage); // 289×17 PNG const filter = new LutFilter({ mode: '3d', size: 17 }).setLut(lut); sprite.filters = [filter]; // Animated per-channel curves - shift the ramp every frame: const ramp = LutFilter.identityLut1D(); const filter = new LutFilter({ mode: 'rgb1d' }).setLut(ramp); // Replace `ramp.source` per frame with a shifted copy. ``` Runs on a ShaderFilter carrying both a GLSL and a WGSL source, so it works on either backend without the caller choosing one.
import { LutFilter } from '@codexo/exojs'A Filter that maps every pixel of the input through a Look-Up Table texture.
Two storage modes: - **RGB 1D LUT** (`N×1`, default `N=256`): three independent per-channel curves - `R' = lut(src.r).r`, `G' = lut(src.g).g`, `B' = lut(src.b).b`, alpha untouched. Used for levels/curves-style grading, colour ramps, posterisation and animated recolouring. - **3D LUT** (`N²×N` unwrapped cube): indexed by the full source RGB with trilinear interpolation between slices. Used for cinematic colour grading, tone mapping, film stock emulation, accessibility filters (color-blindness simulation), and similar standard colour-pipeline tasks. `N=17` matches DaVinci/OBS export defaults.
A 1D LUT cannot express cross-channel mixing (that is what the 3D mode is for), and it is not an indexed-colour palette lookup: each channel only ever sees its own curve.
## Quick start
```ts // Color-graded look from a 17³ LUT exported by your DCC/grading tool: const lut = LutFilter.fromImage(myLutImage); // 289×17 PNG const filter = new LutFilter({ mode: '3d', size: 17 }).setLut(lut); sprite.filters = [filter];
// Animated per-channel curves - shift the ramp every frame: const ramp = LutFilter.identityLut1D(); const filter = new LutFilter({ mode: 'rgb1d' }).setLut(ramp); // Replace `ramp.source` per frame with a shifted copy. ```
Runs on a ShaderFilter carrying both a GLSL and a WGSL source, so it works on either backend without the caller choosing one.
new(options: LutFilterOptionsConstruction options for LutFilter.): LutFilterapply(backend: RenderBackend, input: RenderTextureAn off-screen render target that can also be sampled as a texture. Combines RenderTarget (framebuffer attachment) with the sampler parameters of a Texture (sca…, output: RenderTextureAn off-screen render target that can also be sampled as a texture. Combines RenderTarget (framebuffer attachment) with the sampler parameters of a Texture (sca…, resolution: number): voiddestroy(): voidgetOutputBounds(input: ReadonlyRectangleRead-only view of a Rectangle: every accessor and non-mutating query a rectangle offers, with none of its writers. Returned by APIs that hand out a LIVE intern…, output: RectangleMutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements Collidable with full SAT collision response f…): voidinvalidate(): voidfromImage(image: HTMLCanvasElement | HTMLImageElement): TextureA static GPU texture sourced from an image, canvas, or video element. Holds the pixel source, its sampling state (ScaleModes, WrapModes) and its upload state (…resolution: TargetResolutionsize: number