Skip to content
🎉 Angular Three v4 is here! Read the announcement

Introduction

angular-three-postprocessing provides a comprehensive set of post-processing effects for your 3D scenes. It wraps the popular postprocessing library for use with Angular Three.

No additional peer dependencies required beyond the core dependencies.

Terminal window
npm install angular-three-postprocessing postprocessing three-stdlib maath
# yarn add angular-three-postprocessing postprocessing three-stdlib maath
# pnpm add angular-three-postprocessing postprocessing three-stdlib maath

Post-processing effects are applied using the NgtpEffectComposer component, which wraps one or more effect components:

import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { NgtpEffectComposer, NgtpBloom, NgtpVignette } from 'angular-three-postprocessing';
@Component({
template: `
<ngt-mesh>
<ngt-box-geometry />
<ngt-mesh-standard-material color="hotpink" />
</ngt-mesh>
<ngtp-effect-composer>
<ngtp-bloom [options]="{ luminanceThreshold: 0.9, intensity: 0.5 }" />
<ngtp-vignette [options]="{ darkness: 0.5 }" />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpBloom, NgtpVignette],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class SceneGraph {}

The NgtpEffectComposer accepts the following options:

PropertyTypeDefaultDescription
enabledbooleantrueWhether the effect composer is enabled
depthBufferbooleanundefinedWhether to use a depth buffer
stencilBufferbooleanundefinedWhether to use a stencil buffer
enableNormalPassbooleanundefinedEnable normal pass (required for some effects like N8AO)
autoClearbooleantrueAuto-clear output buffer before rendering
resolutionScalenumberundefinedResolution scaling factor
multisamplingnumber8MSAA samples (0 to disable)
frameBufferTypeTextureDataTypeHalfFloatTypeFrame buffer data type
renderPrioritynumber1Render priority
cameraCameraundefinedCustom camera (uses default if not provided)
sceneSceneundefinedCustom scene (uses default if not provided)
EffectSelectorDescription
NgtpAsciingtp-asciiASCII art effect
NgtpBloomngtp-bloomBloom/glow effect
NgtpBrightnessContrastngtp-brightness-contrastBrightness and contrast adjustment
NgtpChromaticAberrationngtp-chromatic-aberrationChromatic aberration effect
NgtpColorAveragengtp-color-averageColor averaging effect
NgtpColorDepthngtp-color-depthColor depth reduction
NgtpDepthngtp-depthDepth visualization
NgtpDepthOfFieldngtp-depth-of-fieldDepth of field effect
NgtpDotScreenngtp-dot-screenDot screen effect
NgtpFXAAngtp-fxaaFast approximate anti-aliasing
NgtpGlitchngtp-glitchGlitch effect
NgtpGodRaysngtp-god-raysGod rays/light shafts
NgtpGridngtp-gridGrid overlay
NgtpHueSaturationngtp-hue-saturationHue and saturation adjustment
NgtpLensFlarengtp-lens-flareLens flare effect
NgtpLUTngtp-lutLUT color grading
NgtpNoisengtp-noiseNoise effect
NgtpOutlinengtp-outlineOutline effect
NgtpPixelationngtp-pixelationPixelation effect
NgtpScanlinengtp-scanlineScanline effect
NgtpSelectiveBloomngtp-selective-bloomSelective bloom on specific objects
NgtpSepiangtp-sepiaSepia tone effect
NgtpShockWavengtp-shock-waveShock wave distortion
NgtpSMAAngtp-smaaSubpixel morphological anti-aliasing
NgtpTiltShiftngtp-tilt-shiftTilt-shift blur
NgtpTiltShift2ngtp-tilt-shift-2Alternative tilt-shift implementation
NgtpToneMappingngtp-tone-mappingTone mapping
NgtpVignettengtp-vignetteVignette darkening
NgtpWaterngtp-waterWater effect

For ambient occlusion, install the additional dependency:

Terminal window
npm install n8ao
import { NgtpN8AO } from 'angular-three-postprocessing/n8ao';
@Component({
template: `
<ngtp-effect-composer [options]="{ enableNormalPass: true }">
<ngtp-n8ao [options]="{ aoRadius: 0.5, intensity: 1 }" />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpN8AO],
})
export class SceneGraph {}

Effects are applied in the order they appear. You can combine multiple effects:

<ngtp-effect-composer>
<!-- Anti-aliasing first -->
<ngtp-smaa />
<!-- Then visual effects -->
<ngtp-bloom [options]="{ intensity: 0.5 }" />
<ngtp-chromatic-aberration [options]="{ offset: [0.002, 0.002] }" />
<!-- Color grading last -->
<ngtp-vignette [options]="{ darkness: 0.5 }" />
<ngtp-noise [options]="{ opacity: 0.02 }" />
</ngtp-effect-composer>
  1. Disable when not needed: Set enabled to false on the effect composer when effects aren’t needed
  2. Reduce multisampling: Lower multisampling value for better performance
  3. Use resolution scaling: Set resolutionScale below 1 for lower-resolution effects
  4. Limit effects: Each effect adds GPU overhead; use only what’s necessary