postprocessing icon indicating copy to clipboard operation
postprocessing copied to clipboard

feat: add LensFlareEffect

Open shotamatsuda opened this issue 10 months ago • 3 comments

Related issue: https://github.com/pmndrs/postprocessing/issues/581

Description

This PR adds a LensFlareEffect based on https://www.froyok.fr/blog/2021-09-ue4-custom-lens-flare/.

image

Limitations

  • Uses a simple bloom glare instead of a starburst shape.
  • Ghosts and halos are not configurable.
  • No anamorphic distortion.

Considerations

  • Luminance threshold and bloom overlap with existing effects and passes. Separating them would require two additional passes, but is a possible option.
  • The downsampling follows Sledgehammer Games’s method 1 2, which differs from DownsamplingMaterial. I have yet to compare and determine which is better.
  • Ghosts could be made configurable, but it might require a bit complex parameter interface.

shotamatsuda avatar Mar 09 '25 06:03 shotamatsuda

Thanks! I'll take a closer look at this when I have more time on my hands.

At a glance, it looks like this effect duplicates the bloom effect which is suboptimal from a maintenance perspective. If this effect doesn't require the bloom-related code, it should be removed.

It might also make sense to create a dedicated LensFlarePass for the LensFlareFeaturesMaterial to implement lens-flare-specific configuration options in that pass. The pass would then be used instead of the internal ShaderPass.

I'm also not sure about the duplicated luminance threshold and downsampling code. It would be better if the existing passes could be reused.

vanruesc avatar Mar 09 '25 23:03 vanruesc

Thanks for reviewing! I agree with your points and will work on those changes.

shotamatsuda avatar Mar 10 '25 13:03 shotamatsuda

Wow excited for this one, thanks @shotamatsuda for your work!

kitaedesigns avatar Apr 01 '25 15:04 kitaedesigns