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

NgtpDepth

The depth effect visualizes the scene’s depth buffer, useful for debugging or creating stylized depth-based visuals.

import { NgtpEffectComposer, NgtpDepth } from 'angular-three-postprocessing';
@Component({
template: `
<ngtp-effect-composer [options]="{ depthBuffer: true }">
<ngtp-depth [options]="{ inverted: false }" />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpDepth],
})
export class SceneGraph {}
PropertyTypeDefaultDescription
invertedbooleanfalseInvert the depth visualization
@Component({
template: `
<!-- Multiple objects at different depths -->
<ngt-mesh [position]="[0, 0, 0]">
<ngt-box-geometry />
<ngt-mesh-standard-material color="red" />
</ngt-mesh>
<ngt-mesh [position]="[2, 0, -3]">
<ngt-sphere-geometry />
<ngt-mesh-standard-material color="blue" />
</ngt-mesh>
<ngt-mesh [position]="[-2, 0, -6]">
<ngt-cone-geometry />
<ngt-mesh-standard-material color="green" />
</ngt-mesh>
<ngtp-effect-composer [options]="{ depthBuffer: true }">
<ngtp-depth />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpDepth],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class SceneGraph {}
  • Ensure depthBuffer: true is set on the effect composer
  • White represents near objects, black represents far objects (unless inverted)
  • Useful for debugging depth-based effects like depth of field
  • Can be combined with other effects for artistic depth-based styling