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: - **1D LUT** (`N×1`, default `N=256`): indexed by the source's red channel only. Used for palette cycling, indexed-colour effects, and luminance-based recoloring. - **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. ## 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]; // Palette cycling — rotate a 1D palette every frame: const palette = LutFilter.identityLut1D(); const filter = new LutFilter({ mode: '1d' }).setLut(palette); // Replace `palette.source` per frame with a shifted copy. ``` Internally creates a WebGl2ShaderFilter or WebGpuShaderFilter on first apply, depending on the active backend.
import { LutFilter } from '@codexo/exojs' A Filter that maps every pixel of the input through a Look-Up Table texture.
Two storage modes: - **1D LUT** (`N×1`, default `N=256`): indexed by the source's red channel only. Used for palette cycling, indexed-colour effects, and luminance-based recoloring. - **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.
```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];
// Palette cycling — rotate a 1D palette every frame: const palette = LutFilter.identityLut1D(); const filter = new LutFilter({ mode: '1d' }).setLut(palette); // Replace `palette.source` per frame with a shifted copy. ```
Internally creates a WebGl2ShaderFilter or WebGpuShaderFilter on first apply, depending on the active backend.
new(options: LutFilterOptions): LutFilter apply(backend: RenderBackend, input: RenderTexture, output: RenderTexture): void destroy(): void setLut(lut: Texture): this fromImage(image: HTMLCanvasElement | HTMLImageElement): Texture identityLut1D(size: number): Texture identityLut3D(size: number): Texture lut: Texture mode: LutMode size: number