GPU Particle Systems Emitting Increase Over Time?

wait but this one works as you want right?
Shader Effect Problem | Babylon.js Playground

Only one particle active at the time

Kinda, but that was just to demonstrate the compounding rate with GPU ones and how normal ones did not.

Here is more of a “real” example.

If we crank the emit rate up to lets say 10 or something its not really noticeable, but at two you can see how the GPU one just runs away.

So in cases where like Im doing a rain or snow effect where the system counts might be more like 2k-4k and emitting at 200-300, the GPU one ends up going all in eventually while the CPU one stays at the rate that one would expect.

yes here you have to limit your rate to add new knowing you recycle
and also limit the max buffer size:
Shader Effect Problem | Babylon.js Playground

The other aspect is that manualEmitCount is not implemented. User can set _accumulatedCount ro the desired number of particles and they will be created. That was a workaround I discovered. See GPU Particle Systems Emitting Increase Over Time? - #11 by HiGreg

let me check what it would take to support manualEmitCout

And here we are: Add support for manualEmitCount for GPUParticles by deltakosh · Pull Request #16108 · BabylonJS/Babylon.js

This PG will work as expected after the PR is merged:
Shader Effect Problem | Babylon.js Playground

Hi! Just checking in, as I needed manualEmitCount in a GPU system as well. Is that PG correct? It seems like it is refilling the particle count to N as soon as any particles die.. I would expect that setting manualEmitCount to N would emit N particles and then immediately reset the emission count to zero afterwards, in essense behaving the same as the CPU Particles:

Unfortunately this is a limit of the GPU particle system. The particles are constantly recycle by the GPU (remember, everything runs on the GPU with no oversight from the CPU). So as we work with constant memory, as soon as a particle is dead, it is regenerated into a new one.

The manual emit count pumps N particles into the system but they will “live” forever :slight_smile:

if you want you can still setTimeout based on the particle life time and dispose the system accordingly:

Shader Effect Problem | Babylon.js Playground

Ok! I think I understand… I seem to be able to replicate the CPU-style manual emit by emitting from from frame N and then calling stop() on the particle system on frame N+1…

    var frame = 0.0;
    var emitFrame = 120.0;
    scene.beforeRender = function () {
        frame += 1.0;    
        if (frame == emitFrame) {
                particleSystem.manualEmitCount = 400.0;
        }
        if (frame == emitFrame + 1.0) {
                particleSystem.stop();
        }
    }

Thanks for taking the time to explain!