Skip to content

EffectComposer

EffectComposer

The EffectComposer is a crucial component in Angular Three’s postprocessing pipeline. It allows you to combine multiple postprocessing effects and apply them to your 3D scene. The EffectComposer manages the rendering process, applying effects in the order they are defined.

Usage

To use the EffectComposer, wrap your effects inside the <ngtp-effect-composer> component:

<ngtp-effect-composer>
<!-- Add your effects here -->
<ngtp-bloom [options]="bloomOptions" />
<ngtp-vignette [options]="vignetteOptions" />
</ngtp-effect-composer>

Options

The EffectComposer accepts the following options:

OptionTypeDefaultDescription
enabledbooleantrueEnables or disables the EffectComposer
depthBufferbooleanundefinedEnables depth buffer
stencilBufferbooleanundefinedEnables stencil buffer
autoClearbooleantrueAutomatically clears the render target
resolutionScalenumberundefinedScales the render resolution
multisamplingnumber8Sets the number of samples for multisampling anti-aliasing
frameBufferTypeTextureDataTypeHalfFloatTypeSets the frame buffer type
renderPrioritynumber1Sets the render priority
cameraCameraundefinedCustom camera for rendering
sceneSceneundefinedCustom scene for rendering

Examples

  1. Basic usage with Bloom and Vignette effects:
<ngtp-effect-composer>
<ngtp-bloom [options]="{ luminanceThreshold: 0.6, luminanceSmoothing: 0.5, intensity: 1.2 }" />
<ngtp-vignette [options]="{ offset: 0.5, darkness: 0.5 }" />
</ngtp-effect-composer>
  1. Using EffectComposer with custom options:
<ngtp-effect-composer [options]="{ autoClear: false, multisampling: 0 }">
<ngtp-outline [options]="{ edgeStrength: 2.5, pulseSpeed: 0, blur: true, kernelSize: KernelSize.SMALL }" />
<ngtp-smaa />
</ngtp-effect-composer>
  1. Combining EffectComposer with other scene elements:
<ngt-color attach="background" *args="['black']" />
<ngts-orbit-controls />
<ngt-ambient-light />
<ngt-point-light [position]="[0, -1, -1]" [decay]="0" color="green" />
<ngt-directional-light [position]="[0, 1, 1]" />
<!-- Your 3D objects here -->
<ngtp-effect-composer>
<ngtp-outline [options]="outlineOptions" />
<ngtp-smaa />
</ngtp-effect-composer>