Flashbang VFX | Technical Documentation

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.

Example
Need help?

If you have any questions or concerns you may find them addressed in the Frequently Asked Questions section at the bottom of this page. If you can’t find what you’re looking for you can reach me at [email protected] and in the techarthub Community Discord server.

Table of Contents

BP_Flashbang

BP_Flashbang is physics object that can be spawned in a variety of ways (in the provided 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 informing the character of the intensity of the effect via a FlashInstance struct.

Functions

CheckForBlocked

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.

CalculateInstanceValues

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.

GetScorchMarkLocation

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 epicenter to place the decal.

GetScorchMarkRotation

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 that can produce a lot of undesirable stretching.

Initial scorch decal placement (left) and the result of changing its rotation to reduce stretching.

It does this by drawing a series of line traces that radiate outward from the detonation point and averaging the surface normal of any hits.

The DecalDirectionCheckTraceCount value defines how many traces are
drawn when checking nearby geo for scorch mark placement.

DrawScorchMark

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.

BP_DemoCharacter

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:

  • SceneCaptureComponent2D (for the afterimage)
  • Ringing (an Audio Component for the ringing noise)

Events

StartFlashFade

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.

Functions

InitializeFlash

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.

FadeFlash

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 of the explosion.

Settings

Structs

NameDescription
FlashbangSettingsGeneral settings for the flash grenade (fuse time, explosion radius etc.)
FlashInstanceThe values sent from the grenade to all affected characters.

Float Curves

NameDescription
AfterimageIntensityThe strength of the afterimage effect
FlashAngleDefines the intensity of the effect based on view angle in degrees
FlashDistanceDefines the intensity of the effect based on distance
FlashDurationHow long the player remains ‘fully flashed’
FlashFadeSpeedThe speed at which the blinding effect will fade
FlashIntensityThe strength of the white blinding effect
RingingIntensityThe 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.

I am a technical artist from Adelaide, Australia. I created techarthub to share my knowledge and love for this industry. I hope you feel it too!

Scroll to Top