Skip to content

PostprocessingSyncSystem ​

Builds and manages the post-processing chain from the Postprocessing component's state, enabling full-screen visual effects in the rendered scene. The chain comes from the world's render backend: an EffectComposer on WebGL, a TSL RenderPipeline with webgpuBackend.

Overview ​

PostprocessingSyncSystem runs every frame and is responsible for:

  • Asking the backend (world.getRenderBackend().createPostprocessing(...)) for a chain built from the enabled effects in Postprocessing. On WebGL that is an EffectComposer with a RenderPass base and one pass per effect.
  • Rebuilding the chain when the effect configuration changes (detected by signature), or updating it in place when the backend supports that (WebGPU does for parameter-only changes).
  • Handing off the composer to RenderSystem via scene.userData.ecsPostprocessingComposer so the render pass uses it instead of the default renderer.render().
  • Disposing old composers and passes when the configuration changes or the component is removed.

Queried components ​

ComponentAccess
PostprocessingRead (effects array and each effect's enabled/parameter state)

Supported effects ​

WebGL backend (the WebGPU mapping is on the WebGPU and TSL page):

EffectTHREE.js pass
bloomUnrealBloomPass
dotScreenDotScreenPass
glitchGlitchPass
filmFilmPass
bokehBokehPass
ssaoSSAOPass
hueSaturationShaderPass (HueSaturationShader)
sepiaShaderPass (SepiaShader)
vignetteShaderPass (VignetteShader)
chromAberrationShaderPass (RGBShiftShader)
pixelationPixelation ShaderPass (block sampling, sized in device pixels)
smaaSMAAPass, placed right before OutputPass
toneMappingNo pass: sets renderer.toneMapping / toneMappingExposure, which OutputPass applies

Pass order: render → dof → bloom → vignette → hueSaturation → sepia → noise → dotScreen → ssao → glitch → chromAberration → pixelation → smaa → OutputPass.

Behavior notes ​

  • Composer handoff: when the composer is active, scene.userData.ecsPostprocessingComposerActive is set to true and scene.userData.ecsPostprocessingComposer holds the chain (on WebGL, the EffectComposer itself). RenderSystem checks this flag and delegates rendering to the chain instead of calling renderer.render() directly. scene.userData.ecsPostprocessing holds the values it was built from.
  • Signature-based rebuild: the full effect configuration is serialized each frame and nothing happens while it is unchanged. On a change the WebGL backend rebuilds the composer; the WebGPU backend writes new parameters into its uniforms and rebuilds only when an effect is switched on or off.
  • WebGPU without webgpuBackend: the world warns once and builds no chain (tone mapping still applies through the renderer). EffectComposer never runs on a WebGPURenderer.
  • Tone mapping: the toneMapping effect (with postEnabled on) uses ACES Filmic unless Environment.values.lighting.toneMapping names an operator, and its exposure overrides the environment's. Turning the effect off hands the renderer back to the environment's settings, or to its original values when there are none.
  • Cleanup: when the Postprocessing component is removed from the scene, or when the composer is rebuilt, all existing passes are disposed and the composer is torn down.

API reference ​