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

NgtpLensFlare

The lens flare effect simulates camera lens artifacts including glare, ghosts, and anamorphic streaks. It automatically fades when the light source is occluded by scene objects.

import { NgtpEffectComposer, NgtpLensFlare } from 'angular-three-postprocessing';
@Component({
template: `
<ngtp-effect-composer>
<ngtp-lens-flare [options]="{
position: [5, 5, -10],
glareSize: 0.5
}" />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpLensFlare],
})
export class SceneGraph {}
PropertyTypeDefaultDescription
positionNgtVector3[0, 0, 0]Light source position
followMousebooleanfalseFollow mouse cursor position
smoothTimenumber0.07Smoothing time for mouse following
glareSizenumber0.35Size of the main glare
starPointsnumber6Number of star burst points
flareSizenumber0.005Size of secondary flares
flareSpeednumber0.4Animation speed of flares
flareShapenumber0.1Shape factor of flares
animatedbooleantrueEnable flare animation
anamorphicbooleanfalseEnable anamorphic streak effect
colorGainColorundefinedColor tint for the flare
lensDirtTextureTextureundefinedLens dirt texture overlay
haloScalenumber0.5Scale of the halo effect
secondaryGhostsbooleantrueEnable secondary ghost flares
aditionalStreaksbooleantrueEnable additional streak effects
ghostScalenumber0.3Scale of ghost flares
opacitynumber1.0Overall opacity
starBurstbooleantrueEnable star burst effect
@Component({
template: `
<!-- Sun/light source -->
<ngt-mesh [position]="[10, 8, -20]">
<ngt-sphere-geometry *args="[2, 32, 32]" />
<ngt-mesh-basic-material color="#ffffaa" />
</ngt-mesh>
<!-- Scene objects -->
<ngt-mesh [position]="[0, 0, 0]">
<ngt-box-geometry />
<ngt-mesh-standard-material color="gray" />
</ngt-mesh>
<ngtp-effect-composer>
<ngtp-lens-flare [options]="{
position: [10, 8, -20],
glareSize: 0.6,
starPoints: 8,
anamorphic: true,
secondaryGhosts: true
}" />
<ngtp-bloom [options]="{ intensity: 0.3 }" />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpLensFlare, NgtpBloom, NgtArgs],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class SceneGraph {}
@Component({
template: `
<ngtp-effect-composer>
<ngtp-lens-flare [options]="{
followMouse: true,
smoothTime: 0.1,
glareSize: 0.4
}" />
</ngtp-effect-composer>
`,
imports: [NgtpEffectComposer, NgtpLensFlare],
})
export class SceneGraph {}
  • The flare automatically fades when occluded by scene geometry
  • Enable anamorphic for horizontal streak effects common in cinema
  • Use lensDirtTexture for realistic dirty lens simulation
  • Combine with bloom for enhanced glow around the light source
  • Position should match your actual light source for realistic occlusion