Thank you for your interest in Flashbang VFX! On this page you’ll find a breakdown of each of the Blueprints found in the project, how they’re intended to be used, and how they work together to create the effect seen in this video.
There is a frequently asked questions section at the bottom of this page but if you have any feedback, questions, or feature requests please reach out. I’d love to hear from you.
BP_Flashbang is physics object that can be spawned in a variety of ways (in the demo map it’s fired from a gun). It’s responsible for counting down the fuse, the initial flash of light and bang of the grenade’s detonation, and telling the character the intensity of the flash effect via a FlashInstance struct.
Returns true if there is a clear line of sight between the grenade and the camera. We use this to see if the player is to be blinded via the post-processing material, or to just rely on the light flash in scene. If you don’t directly see the grenade explode, you won’t be as affected.
This is arguably the most important function in the project. It’s responsible for returning a FlashInstance struct based on the distance and view angle from the grenade’s detonation. This is where we set all the initial values of the flash, whether or not it’s in our peripheral vision or not, and how long the effect should last.
It uses a series of float curves to set these values, which makes it really easy to tweak the effect to suit your own project. More information on those is in the curves section further down.
When a grenade explodes we look to draw a scorch mark on the nearest suitable surface. This function will get all static geometry in the blast radius, and find the nearest location from the epicentre to place the decal.
Once we have our scorch decal location, we use this function to calculate the optimal rotation for its placement. This is to avoid (as much as is possible) strange edge cases where it draws into a corner as there can be a lot of undesirable stretching.
It does this by drawing a series of line traces that radiate outward from the detonation point, and averaging the surface normals.
Draws a scorch mark decal at the specificed location with a random roll rotation. Sets the fade time based on the ScorchMarkFadeDuration value in the FlashbangSettings struct.
This actor is basically the vanilla FPP template character with a few bits of additional logic for controlling the effect.
I’ve also added the following components:
This event is fired when the flashbang effect starts to fade, and will loop through at a user-set interval until the fade is complete. This is mostly to avoid using Event_Tick.
This function is fired once for each detonation, and will set the initial values of the effect based on a FlashInstance from BP_Flashbang. It defines the intensity of both blinding and deafening effect.
Fired multiple times as the effect is faded out, this function is where the material/audio values are set. Each of these values are calculated and set separately to account for different scenarios (for example you could be looking away and not blinded, but your ears would still be ringing from the noise.)
|FlashbangSettings||General settings for the flash grenade (Fuse time, explosion radius etc.)|
|FlashInstance||The values sent from the grenade to nearby affected characters.|
|AfterimageIntensity||The strength of the afterimage effect|
|FlashAngle||Defines the intensity of the effect based on view angle in degrees|
|FlashDistance||Defines the intensity of the effect based on distance|
|FlashDuration||How long the player remains ‘fully flashed’|
|FlashFadeSpeed||The speed at which the blinding effect will fade|
|FlashIntensity||The strength of the white blinding effect|
|RingingIntensity||The volume of the ear-ringing effect|
Frequently Asked Questions
Does this support multiplayer?
Yes! This system should dovetail neatly into multiplayer as the grenade handles the explosion and then reaches out to nearby pawns with the intensity of the effect. The logic surrounding the firing and detonation of the grenade is replicated.
Does it work in VR?
After a fashion. The demo character supports VR (in the same way the default FPP character does), but the burned-in afterimage effect is not stereoscopic so it feels more like an image plane stuck to your face.
If there is interest I would be very keen to explore creating a VR-ready version in a future update.