Performance forest fire

So I have a map with some foliage that can ‘be set on fire’. I know how to ‘swap’ the foliage meshes so that at one time it’s ‘healthy’ and another it’s ‘burnt’.
It’s the between time that I am struggling with. My goal is to have as much on fire as possible, while keeping a acceptable performance, say 30+ fps.
But how do I do this? If I for example cast an area spell, that sets the foliage on fire by spawning a particle system at each foliage hit, it can easily be 200+ particle systems being spawned.

Another aspect is the transition. I could have a healthy bush, set it on fire and then spawn a ash pile but that does not look nice.
So now I instead have a custom actor spawn. I remove the bush instance, spawn an actor and when the actors lifetime runs out, it tells the foliage actor to spawn an ash instance.
I kind of like this system since then I can customize this actor to do whatever FX I wish with great control - one actor class for each type of foliage.
Currently the actor has a bush mesh with an instanced material, a fire particle system and an ash pile - each tick the particle system and ash pile’s location is adjusted. The performance is horrible.
(they are all spawned at 0,0,0)

I can’t really see a way to make what I have at the moment performance friendly. So what are some tricks that is used for this kind of big effects?

That’s a higly detailed fire effect, but fortunately particle systems does support LOD which you can maybe utilize to reduce the performace cost of the system. Particle system could also perform better while using GPU particles, which probably can help to futher reduce the costs. But of course, spawning many of these systems will eventually create a bottleneck somewhere and you should limit the spawning of individual systems. I’d thinking to find a way to collapse the adjacent particle systems into one. Perhaps, a shared actor could spawn these systems instead of the individual actors, so it could have a management system for such optimization. But of course if you are willing to set the entire world on fire, you will turn your interest into shader coding at some point, where you can perform most of the operations in a highly optimized gpu based solution.

Why would you do that every tick though?

Once AOE spell is cast, get foliage instances affected and the replace them with burning foliage. Burning foliage should have an ash pile, particle system and two special materials. First material would be applied to the foliage and has to contain some sort of burning animation. Second material would have to be used on your ash pile and should have a reverse animation of ash pile appearing. You can do that either via mask or WPO by having the pile underground initially. There can be different ways how to pass info about animation phase to materials, ranging from using unique MID for each group set on fire, to rendering some sort of world-size mask, that would determine regions of burning/untouched foliage.

As for particle emitters you spawning, use quality sub-uv animation and a few particles for each emitter, rather than relying on quantity of particles. I haven’t worked much with particles in UE4, but I would safely assume that there is an option to auto-destroy particle emitter, once it stops. If that is the case, you won’t have to track emitters in any way either.

Don’t expect thousands of foliage instances on fire, but for practical purposes this should do.

I forgot to mention that the particle effect seen is the fire from starter content or was it content examples. But modified, removed light and made all particles GPU type.
Also, in that picture there’s 200 of them at 0,0,0.

I tried to create one actor instead of having one actor for each static mesh and the performance is already much better, though not at acceptable levels yet (went from 10 fps to 25). I would post this picture I took but it’s not letting me.
I’ve also thought about checking if there’s a tight cluster of meshes, and if so only spawn one particle system in the center of that cluster and scale it, though I don’t know how to do that sort of thing yet.
A third option I’ve thought about is having a particle culling actor - every time a not-so-important system is spawned, it’s added to an array, and if the frames drop, delete systems far away from the player or something like that.

About that shader coding, I’m guessing that is the material? I indeed have to dive into that.

But again, any suggestions are welcome for… large scale visual effects.

Actually, most of the things you describe in the first paragraph is what I’m doing in some way.
The ash pile appearing via WPO from under the ground.
The burning bush has a MID that… hides it gradually downwards through a mask.
The particle system WPO is adjusted downwards to follow the culling of the bush mesh.
But these things, including setting a scalar variable of the MID requires a frame update to be smooth, right?

Yes materials are compile to shader instructions for the GPU. UE have this nice option to visually assemble the functionality, but it is not really optimized for all sorts of ideas. That’s where coding comes in play (look into the ./Engine/Shaders/*.usf files), and if you find a smart solution to set an entire planet on fire, you might as well can get away with it!

That sounds like a good idea, and if you’re determined enough to resolve this problem you can perhaps write a suitable particle spawner that is bound to the mask informations.

Exactly. Apart from the last part. Instead of setting FireScalarParameter every tick, I would do it only once. On a fire start that is. And inside the mat I would do something like:

AnimationPhase=  clamp ( 0 + Time * FireScalarParameter   )