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:

1
<ngtp-effect-composer>
2
<!-- Add your effects here -->
3
<ngtp-bloom [options]="bloomOptions" />
4
<ngtp-vignette [options]="vignetteOptions" />
5
</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:
1
<ngtp-effect-composer>
2
<ngtp-bloom [options]="{ luminanceThreshold: 0.6, luminanceSmoothing: 0.5, intensity: 1.2 }" />
3
<ngtp-vignette [options]="{ offset: 0.5, darkness: 0.5 }" />
4
</ngtp-effect-composer>
  1. Using EffectComposer with custom options:
1
<ngtp-effect-composer [options]="{ autoClear: false, multisampling: 0 }">
2
<ngtp-outline [options]="{ edgeStrength: 2.5, pulseSpeed: 0, blur: true, kernelSize: KernelSize.SMALL }" />
3
<ngtp-smaa />
4
</ngtp-effect-composer>
  1. Combining EffectComposer with other scene elements:
1
<ngt-color attach="background" *args="['black']" />
2
3
<ngts-orbit-controls />
4
5
<ngt-ambient-light />
6
<ngt-point-light [position]="[0, -1, -1]" [decay]="0" color="green" />
7
<ngt-directional-light [position]="[0, 1, 1]" />
8
9
<!-- Your 3D objects here -->
10
11
<ngtp-effect-composer>
12
<ngtp-outline [options]="outlineOptions" />
13
<ngtp-smaa />
14
</ngtp-effect-composer>