A study recreating the iconic afterimage effect from Cyberpunk Edgerunners. The trick is generating particle sprites sized to the mesh's screen-space bounds, then applying a render target mask so only the character silhouette shows. This combines a lot of different techniques: Blueprint scripting, Niagara, stencil masks, render targets, dot products, and screen-to-world projection math.

Sandevistan afterimage effect from Cyberpunk Edgerunners (Studio Trigger)

First I needed to figure out where the character appears on screen and translate that back to world space. The red plane in the debug view shows the screen-space bounding box projected into the 3D scene.

Screen bounds visualized as red plane
The GetScreenBounds function takes the mesh's component bounds (8 corners of the bounding box), projects each corner from world space to screen space using ProjectWorldToScreen, then finds the min/max X and Y values to get the screen-space rectangle.

GetScreenBounds function with 8-corner projection
This is the tricky math part. Using the camera location, forward vector, FOV angle (via tangent), and viewport size, I calculate where in world space to place the sprite so it appears at the correct screen position. Dot products help project vectors and get the right distances.

Camera FOV and dot product math for world position
The main spawning logic: spawn a Niagara system at the character's location, get the current screen bounds, create a render target sized to match, then pass all the data (sprite size, position, render target texture) to the Niagara system as variables.

Spawn system with render target creation
The material reads the render target, applies a Gaussian blur for softness, then uses edge detection (subtract, abs, multiply) to extract just the outline. The particle color input controls the neon glow tint, and it outputs to emissive for that bright look.

Blur + edge detection for outline extraction
It's a lot of different systems working together: screen-to-world math, render targets, Niagara sprites, and material edge detection. The effect looks simple but there's a lot happening under the hood to make those neon outlines trail behind the character correctly.
Niagara VFX
Sprite particles
Render Targets
Character capture
Stencil Buffers
Masking
Blueprint
Bounds & spawning
Dot Product
Projection math
Gaussian Blur
Edge softening