Skip to main content

Function: createBloomEcsSystem()

createBloomEcsSystem(renderContext): EcsSystem<[CameraEcsComponent, BloomEcsComponent], void, void>

Defined in: rendering/systems/bloom-system.ts:55

Creates a bloom post-processing system: an additive glow around the brightest parts of the scene.

For each camera with both a renderTarget and a BloomEcsComponent, extracts the pixels brighter than threshold into a downsampled scratch buffer, blurs them with the same separable technique as createGaussianBlurEcsSystem, then adds the blurred result back onto the camera's renderTarget. Cameras without a renderTarget, or without a BloomEcsComponent (attach one with addBloomComponent), are left untouched.

Must be registered after the render system (so there's a scene to bloom) and before the present system (so the result gets drawn to the canvas). If a camera also has a GaussianBlurEcsComponent, register this system before the blur system, so the glow gets softened along with the rest of the scene rather than sharpening it back up afterwards.

Parameters

renderContext

RenderContext

The rendering context

Returns

EcsSystem<[CameraEcsComponent, BloomEcsComponent], void, void>

The bloom ECS system