Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add LensFlareEffect #695

Draft
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

shotamatsuda
Copy link

@shotamatsuda shotamatsuda commented Mar 9, 2025

Related issue: #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 shotamatsuda changed the title Feat/lens flare effect Add LensFlareEffect Mar 9, 2025
@shotamatsuda shotamatsuda changed the title Add LensFlareEffect feat: add LensFlareEffect Mar 9, 2025
@vanruesc
Copy link
Member

vanruesc commented Mar 9, 2025

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.

@shotamatsuda
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants