How to hide anamorphic lens flare when out of camera view and occluded?

Hey everyone,

I noticed that with the introduction of Post Process Stack, some things have changed and anamorphic lens flare, which used to be a feature, is now gone. So I’m trying to setup something using a particle system and scaled anamorphic lens flare texture.

It works in that it renders in front of everything.

Now I’m trying to figure out two things.

First, how do I make it fade out when the sun gets occluded by an opaque mesh object. I don’t want it to snap out of existence, but have a quick fade.

Second, how do I make it so when the camera turns and the sun (and flare) are out of sight, the flare itself fades? So in this case, the particle system is not occluded, but the camera no longer sees the sun/flare.

The image below shows the flare. The top has the sun in view, the bottom has the sun out of view (flare out of view as well), yet the flare is still visible and persisting.

The bottom half of the image, it’s hard to see so I circled it in red, but the lens flare is still visible when it should have faded out by now.

I would love comprehensive solutions to these issues, and would also welcome any links to tutorials that cover this.

Thanks!

Does this happen to be in-game? It’s hard to tell… Anyway, why don’t you just use the components for lens flares? There is a FlareRenderer component for a reason. You might want to try that. It performs quite well.

Hope this helps!