Spawn particles when amount is less than initial burst spawn

Hi everyone,

I’m working on a personal prototype and finally arrived to the VFX part.
Niagara has been a huge step up from cascade that I worked with some 4-5 years ago.

I have a particle burst spawn, creating 30 particles in an system that loops once and infinite.
These GPU particles are then used on a character using the pendulum constraint to simulate a chain with various effects such as fake IK positions, point attractions etc.

I use distance field collision but of course there are still cases where the particles get killed, i.e rotates into a wall or similar.

I know what I want to do but I’m very new to custom Niagara modules.
Is it somehow possible to check the initial spawn count with engine.emitter.NumParticles or is there another parameter I am missing?
I then want to compare this number with currently active particles in the emitter.

I’ve tried various thing;
Initial instant burst spawn with a separate spawn rate node that ticks out a new particle once every so often.
Issue with the above is I can’t limit the count, I was hoping to use the spawn probability and scale that on a float curve but again, I can’t find a value for currently alive particles.

Removing the burst spawn and go with a spawn rate and lifetime solution, I don’t like this as this will constantly spew out new particles making the effect instable and less optimized.

My final hope is of course making a module but I can’t figure out how to pass / store data such as I’ve seen some people do with the particle ID.
I’m feel like this final part is the best solution logically plus it will give more practice with using modules but I can’t figure out how to start.

Does anyone know of a tutorial or a similar system that I could deconstruct? I have looked trough the complex examples in UE4 project but I can’t find what I’m looking for.

Regards

Marcus

I think it’s possible to do what you are asking for. You might get some issues with sorting, but this should work, at least it will keep the num of particles consistent. If you don’t mind spawning them 1 particle / frame. The ‘MaxParticles’ int parameter is not necessary. I just added it for simplicity.



Hi Tobias,

This is similar to my first approach, my issue was I couldn’t use a bool to compare int values which the Spawn Per Frame solves. Many thanks for that :+1:

I’m currently digging trough the advance Niagara examples trying to figure out how to make a ID read of each particle.

Strangely enough I tried this and it worked the first time I compiled, but as you said, the ID generation is messed up (that will be the second problem to solve).
However, whenever I run it now it only ever spawns one particle regardless of the MaxParticles value.

This seem to be my issue in general, on “collision death” I assumed that the particles were killed when they disappeared but the particles are still in the emitter (ID count 30 particles so I assume NumParticles remains 30 as well) which means I need to figure out a way to query the current particle count in the emitter during runtime.

I will try to take some screens later today and post to explain my issue in more depth.