The EffectComposer may be used in place of a normal WebGLRenderer.

The auto clear behaviour of the provided renderer will be disabled to prevent unnecessary clear operations.

It is common practice to use a RenderPass as the first pass to automatically clear the buffers and render a scene for further processing.

Implements

Constructors

  • Constructs a new effect composer.

    Parameters

    • Optionalrenderer: WebGLRenderer

      The renderer that should be used.

    • Optionaloptions: {
          alpha?: boolean;
          depthBuffer?: boolean;
          frameBufferType?: number;
          multisampling?: number;
          stencilBuffer?: boolean;
      }

      The options.

      • Optionalalpha?: boolean

        Deprecated. Buffers are always RGBA since three r137.

      • OptionaldepthBuffer?: boolean

        Whether the main render targets should have a depth buffer.

      • OptionalframeBufferType?: number

        The type of the internal frame buffers. It's recommended to use HalfFloatType if possible.

      • Optionalmultisampling?: number

        The number of samples used for multisample antialiasing. Requires WebGL 2.

      • OptionalstencilBuffer?: boolean

        Whether the main render targets should have a stencil buffer.

    Returns EffectComposer

Properties

autoRenderToScreen: boolean

Determines whether the last pass automatically renders to screen.

inputBuffer: WebGLRenderTarget<Texture>

The input buffer.

Two identical buffers are used to avoid reading from and writing to the same render target.

outputBuffer: WebGLRenderTarget<Texture>

The output buffer.

passes: Pass[]

The passes.

Accessors

  • get multisampling(): number
  • The current amount of samples used for multisample anti-aliasing.

    Returns number

  • set multisampling(arg): void
  • Sets the amount of MSAA samples.

    Requires WebGL 2. Set to zero to disable multisampling.

    Parameters

    • arg: number

    Returns void

Methods

  • Adds a pass, optionally at a specific index.

    Parameters

    • pass: Pass

      A new pass.

    • Optionalindex: number

      An index at which the pass should be inserted.

    Returns void

  • Creates a new render target.

    Parameters

    • depthBuffer: boolean

      Whether the render target should have a depth buffer.

    • stencilBuffer: boolean

      Whether the render target should have a stencil buffer.

    • type: number

      The frame buffer type.

    • multisampling: number

      The number of samples to use for antialiasing.

    Returns WebGLRenderTarget<Texture>

    A new render target that equals the renderer's canvas.

    Create buffers manually via WebGLRenderTarget instead.

  • Disposes this composer and all passes.

    Returns void

  • Returns the renderer.

    Returns WebGLRenderer

    The renderer.

  • Returns the internal timer.

    Returns Timer

    The timer.

  • Removes all passes.

    Returns void

  • Removes a pass.

    Parameters

    • pass: Pass

      The pass.

    Returns void

  • Renders all enabled passes in the order in which they were added.

    Parameters

    • OptionaldeltaTime: number

      The time since the last frame in seconds.

    Returns void

  • Replaces the current renderer with the given one.

    The auto clear mechanism of the provided renderer will be disabled. If the new render size differs from the previous one, all passes will be updated.

    By default, the DOM element of the current renderer will automatically be removed from its parent node and the DOM element of the new renderer will take its place.

    Parameters

    • renderer: WebGLRenderer

      The new renderer.

    • OptionalupdateDOM: boolean

      Indicates whether the old canvas should be replaced by the new one in the DOM.

    Returns WebGLRenderer

    The old renderer.

    Use setRenderer instead.

  • Resets this composer by deleting all passes and creating new buffers.

    Returns void

  • Can be used to change the main camera for all registered passes and effects.

    Parameters

    • camera: Camera

      The camera.

    Returns void

  • Can be used to change the main scene for all registered passes and effects.

    Parameters

    • scene: Scene

      The scene.

    Returns void

  • Sets the renderer.

    Parameters

    • renderer: WebGLRenderer

      The renderer.

    Returns void

  • Sets the size of the buffers, passes and the renderer.

    Parameters

    • width: number

      The width.

    • height: number

      The height.

    • OptionalupdateStyle: boolean

      Determines whether the style of the canvas should be updated.

    Returns void