API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classBloomFilter

@codexo/exojs / rendering / stable

A Filter that adds a soft glow around the bright parts of its input - bloom, in the engine's ordinary sRGB path. Pixels whose luminance passes threshold are extracted through a soft knee, carried down a chain of levels halvings, blurred by strength on the smallest of them, carried back up, and added on top of the unchanged input. Only the EXCESS over the threshold glows, so a scene keeps its own colours instead of washing out. The glow is added LIGHT: it carries no alpha of its own, so it brightens whatever it spreads onto and never darkens it, and a half-transparent subject keeps exactly the alpha it came in with. ```ts // A glow around the lamps, leaving everything below 70% luminance alone. world.filters = [new BloomFilter({ threshold: 0.7, intensity: 1.4, strength: 12 })]; ``` The glow reaches `strength * 3` logical units outside its input - the blur's truncation point - plus the spread the halving chain adds on its own, so a subject at rest keeps the room its glow needs. ## Range There is no HDR anywhere in the chain: the input, every intermediate and the result are eight-bit sRGB. The extraction keeps headroom for an intensity of roughly `1 / (1 - threshold)` before the glow saturates to white, which is where the effect stops getting brighter and starts getting flatter. Grading belongs to LutFilter, before or after this one. Runs on a ShaderFilter carrying both a GLSL and a WGSL source, so it works on either backend without the caller choosing one.

6
props
4
methods
0
events
Import
import { BloomFilter } from '@codexo/exojs'

A Filter that adds a soft glow around the bright parts of its input - bloom, in the engine's ordinary sRGB path.

Pixels whose luminance passes threshold are extracted through a soft knee, carried down a chain of levels halvings, blurred by strength on the smallest of them, carried back up, and added on top of the unchanged input. Only the EXCESS over the threshold glows, so a scene keeps its own colours instead of washing out.

The glow is added LIGHT: it carries no alpha of its own, so it brightens whatever it spreads onto and never darkens it, and a half-transparent subject keeps exactly the alpha it came in with.

```ts // A glow around the lamps, leaving everything below 70% luminance alone. world.filters = [new BloomFilter({ threshold: 0.7, intensity: 1.4, strength: 12 })]; ```

The glow reaches `strength * 3` logical units outside its input - the blur's truncation point - plus the spread the halving chain adds on its own, so a subject at rest keeps the room its glow needs.

## Range

There is no HDR anywhere in the chain: the input, every intermediate and the result are eight-bit sRGB. The extraction keeps headroom for an intensity of roughly `1 / (1 - threshold)` before the glow saturates to white, which is where the effect stops getting brighter and starts getting flatter. Grading belongs to LutFilter, before or after this one.

Runs on a ShaderFilter carrying both a GLSL and a WGSL source, so it works on either backend without the caller choosing one.

Constructors1
Methods4
Execute one filter pass: sample from input, write the result to output. Both textures are bounds × resolution texels - NOT the drawable's logical bounding box. Any parameter a subclass expresses in pixels (a blur radius, a displacement amount) is in LOGICAL units by convention and must be multiplied by resolution before it is used as a texel offset; otherwise the effect shrinks by 1/resolution on a HiDPI display. Parameters expressed as a fraction of the target (or as pure colour maths) need no adjustment. The engine always passes resolution. It is optional for the hand-rolled case - a post-processing chain that creates its own RenderTextures and calls apply directly - where the textures are whatever size the caller made them and 1 is the honest answer.
destroy(): void
Release any GPU-side resources held by this filter (uniform buffers, pipelines, intermediate textures). The base drops the attachment list; subclasses with GPU state (BlurFilter, ColorMatrixFilter) override and call super.destroy().
The blur's own truncated reach, plus what the halving chain spreads by itself: each bilinear halving pulls light one texel further and the upsample walks the same distance back, which lands inside 2^levels TEXELS of the pass target. Those texels are logical units only at a resolution of one. A declared resolution BELOW one makes each of them cover more than a logical unit, so a reach stated in logical units has to grow to match or the halo is cut off at the capture edge. 'inherit' is treated as one: the surface it inherits from is at least that, and assuming less would only over-declare.
invalidate(): void
Tell every node this filter is attached to that its rendered output is out of date. Call it after mutating anything that changes what the filter draws or how far it reaches - the stock filters do this from their own setters. Without it a cached or retained representation of the owning node keeps replaying the result the filter produced before the change.
Properties6
resolution: TargetResolution
Resolution this filter's render targets are rasterized at, in device pixels per logical unit. 'inherit' (the default) matches the surface the result is composited into, so a filtered subtree stays as sharp as its surroundings on a HiDPI display. Lower it for a filter whose output is low-frequency anyway - a heavy blur at 0.5 costs a quarter of the fragments and is hard to tell apart. A filter CHAIN shares one target size, so the whole chain runs at the lowest resolution any of its filters asks for. ts const blur = new BlurFilter({ strength: 4 }); blur.resolution = 0.5; // half-resolution blur, quarter the fill cost
intensity: number
How much of the extracted highlight is added back. 0 leaves the input untouched.
levels: number
Halvings between the input and the level the blur runs on, 1..5. A cost knob.
quality: number
Tap cap for the blur, see BlurFilterOptions.quality.
strength: number
Gaussian standard deviation of the glow in logical units.
threshold: number
Luminance a pixel needs before it glows, in 0..1 - the middle of a soft transition, not a hard cut.
Source