Advanced sparks for Unreal Engine

First prototype 2021



There’s hardly a game without sparks. But how far are artists willing to go to make them look good? Obviously, a simple sphere mask on a billboard isn’t exactly what you’d want to see in a modern game. I want to talk about my attempts to solve this issue. I conducted many experiments, which resulted in a pipeline that balances visual quality and performance.

Sparks pipeline

After testing in gameplay conditions, it became clear that using eight sides for a spark and a few edges for distortion or ricochet effects is justified. Below is a table showing the approved topology for use:

Below you can see an illustration of the ricochet algorithm. It turned out that there's no need for a large number of edges. A single additional edge is enough to handle one bounce effectively. Ricochets with two or more bounces were excluded from production.

There is a fundamental principle in computer game development (and beyond) that can be roughly formulated as: 

A polygon should never be smaller than a pixel on the screen!

As you can imagine, sparks are no exception. When creating these sparks, I was guided not only by this principle. I'll try to describe the key ideas that went into this pipeline:

- We save polygons wherever possible: using LODs and simplified models for slow-moving sparks;
- Collision and ricochets are disabled at a distance — they're only used in close-up shots;
- Each spark profile is billboarded independently of the others;
- Sparks are artificially scaled up with distance based on their screen size;
- We use a physically correct blackbody model for sparks, just like for fire;
- Only additive blend mode is used for sparks, just like for fire;
- Abandonment of spirals as in the prototype.

When using hundreds of these sparks on screen, profiling showed no noticeable impact on performance.
I hope this material was helpful — and remember: A polygon should never be smaller than a pixel on the screen!