Skip to content

compositor()

ts
function compositor(
  gl: WebGL2RenderingContext,
  renderPass: RenderPass<any>,
  effects: (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 all effects.
  • 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.

Parameters

gl

WebGL2RenderingContext

The WebGL2 context.

renderPass

RenderPass<any>

The main scene render pass.

effects

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

An array of post-processing effects to apply.

Returns

Compositor

Released under the MIT License.