Skip to content

compositor()

ts
function compositor(params: {
  gl: WebGL2RenderingContext;
  renderPass: RenderPass<any>;
  postEffects?: (EffectPass<any> | CompositeEffectPass<any>)[];
}): Compositor;

The compositor handles the combination of the main render pass and the subsequent effects.

It manages:

  • Initialization of the WebGL context for every pass.
  • Automatic creation of intermediate floating-point render targets.
  • Injecting previousPass and inputPass references into effect uniforms.
  • Automatic linking of the previous pass's output texture to the next effect's input.
  • Rendering all passes in the correct order.

The compositor owns its passes' lifecycle: it initializes uninitialized passes with its WebGL2 context, and disposing the compositor disposes every pass.

Parameters

params

Configuration for the compositor.

gl

WebGL2RenderingContext

WebGL2 context used to initialize every pass.

renderPass

RenderPass<any>

Main scene render pass.

postEffects?

( | EffectPass<any> | CompositeEffectPass<any>)[] = []

Post-processing effects applied after the main pass.

Returns

Compositor

Released under the MIT License.