Flashbang effect

I’m looking to implement flashbang grenades or blinding effects into my first person project, but I’m not sure the best way to go about implementing the effect itself. I was hoping you guys could give me some insight here, as it would seem no one has ever made a video or had a discussion about blinding or flashbangs in UE4, at least that I’ve found. These are fairly common in first person games so I think it would be beneficial for more people in the future to talk about. There are a few different ways I was thinking about how the effect could be implemented, all of which I either am not 100% sure how to do, or am not quite satisfied with:

  1. Eye adaptation based blind. I’d prefer this approach if possible because it would likely be the most realistic, it wouldn’t factor in whether you’re looking toward or away from the light but how intense the flash was relative to the player’s surroundings. Attempts to make this work haven’t exactly gone well. Messing with auto exposure settings and throwing really bright lights in front of my characters hasn’t worked in my favor. My character’s eyes always seem to adjust just fine to the immediately appearing and disappearing light. I’ve messed with every eye adaptation setting I could but nothing quite gives that flashbang effect.

  2. Luminance based blind. I don’t know if this is possible either, but in the documentation for eye adaptation, there is mention of a variable called luminance which, as I understand, is basically “how bright the scene is.” I was thinking I could possibly compare the luminance of the scene right before and after the flash and make the duration of the flash based upon the delta of the two. It would have many of the same benefits as the first method. Rather than the effect slowly readjusting to the normal light, I’d have to overlay a frame from the scene from before the flash and/or a white screen using a post process effect, and lerp it’s transparency down to 0% over the duration. The issue with this method is that I simply don’t know how I would program such a thing. Is there a way to get the luminance of a scene and save it as a variable, then compare it against another scene’s luminance?

  3. Rotation based blind. Check if the character can see the grenade when it goes off and apply a similar effect as the luminance based blind, but instead calculate the duration based off of whether the character was facing the grenade or not. This is what Counter Strike does. I could do this fairly easily, except it’s a bit less dynamic than the other two options, as the environment does not factor in and character’s positioning is basically all-or-nothing in terms of how effective the flash is against them. With the first two implementations, flashes in darker areas would be more effective than in brighter areas, etc.

With any method I still run into the issue of not knowing how to save a particular scene and overlay it as a post process effect as you can see in this video of CS:GO. If you look carefully you can see there’s a bit of a transparency of an old frame from before the flash happens which is a nice effect for immersion. Regardless of the method used I’d like to include something like this.

Alright this post is getting really long, to ask an actual question: Do you know how I could achieve the first or second implementation if such a thing is possible? Do you know how I can save a frame and overlay it like in Counter Strike? Feel free to link any resources which might help me along on my journey, and I appreciate any help I get! Keep in mind I’m a bit of a noob with the material editor still, I’m more of a programmer than an artist. I’ll be sure to post a video on how to make flashbangs in UE4 once I get my version going, so future noobs can learn from my trials and tribulations.

Best bet is to just use a post-process material, and blend it in depending on how close they are to the effect source. Just lerping between scene color and a white value will probably be enough. You’ll have to drive the material via blueprint of course.