GPUParticleSystem is still updating with activeParticleCount and emitRate are 0

In my workaround, I’m using a custom param strength to control the particle system, when strength is bigger, I set emit rate and activeParticleCount to bigger, when strength is 0, I expect there is no particles introduced.

playground to reproduce: https://playground.babylonjs.com/#PU4WYI#399
In the play ground, if I set emitRate to 0 then activeParticleCount to 0, the particle system is still updating.
I can understand this when emitRate is 0, but it is weird that activeParticleCount is not in use in this situation.

The problem is activeParticleCount will not be in use until _accumulatedCount > 1, it seems it is not necessary? I think activeParticleCount should work even if _accumulatedCount <= 1, so in my opinion it should be changed to:

if (this._accumulatedCount > 1) {
    const intPart = this._accumulatedCount | 0;
    this._accumulatedCount -= intPart;
    this._currentActiveCount = this._currentActiveCount + intPart;
}
this._currentActiveCount = Math.min(this._activeCount, this._currentActiveCount);

If this is expected, is it possible to achieve my ‘strength’ with GPUParticleSystem and how?

I think this is a bug, the current active count should not be allowed to exceed the maximum number of active particles (_activeCount).

Here’s the PR:

2 Likes