# GPU Particle Systems Emitting Increase Over Time?

**URL:** <https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087>\
**Category:** Questions\
**Created:** [January 20, 2025, 10:52pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087 "2025-01-20T22:52:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 20, 2025, 10:52pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/1 "2025-01-20T22:52:28Z")

</div>

I’ve noticed that if I have a particle effect that runs at a certain rate for a while and then I let it go for 20-30 mins and come it seems that the emission rate increases and there are noticeably more more particles on the screen.

Take this one for example:

> **[Babylon.js Playground](https://playground.babylonjs.com/#NDDQ4R%235)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

If you hit play you will notice a subtle rain effect. But if you leave it for 10-15 mins and come back it will be a monsoon.

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [January 21, 2025, 1:41am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/2 "2025-01-21T01:41:20Z")

</div>

The emitRate and min/max LifeTime I think are particles or time _per frame_. You have 400 particles per frame lasting 5 frames, so a total of 2000 particles exist at once. Was that your intention?

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 21, 2025, 1:55am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/3 "2025-01-21T01:55:09Z")

</div>

Not really the issue, the issue is that the emissions does not stay consistent over large timeframes.

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [January 21, 2025, 2:10am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/4 "2025-01-21T02:10:29Z")

</div>

When we look through the inspector in Actives Particles, we see the number constantly increasing. How if the particles did not die and therefore increased again and again.  
This increases by 1000 every second or so.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 21, 2025, 2:31am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/5 "2025-01-21T02:31:54Z")

</div>

That would still not account for there being noticeably more being emitted 20 mins later vs when the scene first starts. Especially in this kind of setup where they are only alive for a set time and then are off the screen. It should be stable given this setup.

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [January 21, 2025, 2:56am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/6 "2025-01-21T02:56:45Z")

</div>

I modified the example GPUParticleSystem playground.

> **[Babylon.js Playground](https://playground.babylonjs.com/#1ASENS%23377)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

What it _appears_ to be doing is emitting a number of particles each second. The number of particles emitted starts at zero and increases by 1 (edit: i.e. increases by emitRate) every second until it reaches the capacity.

I don’t see it documented this way, so might be inferring incorrectly.

emitRate can be less than 1. Setting it to 0.5 means that the number of particles emitted increases by 1 every two seconds.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 21, 2025, 3:09am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/7 "2025-01-21T03:09:01Z")

</div>

So yeah it should not be doing that, the emit rate should stay at the same number.

Great example to showcase what I’m talking about!

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [January 21, 2025, 3:36am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/8 "2025-01-21T03:36:02Z")

</div>

I think what I’m seeing in that playground, in terms of emitted particles, is corroborated by the source code. [Especially lines 1851-1855](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Particles/gpuParticleSystem.ts#L2077).

The documentation doesn’t seem to match.

> emitRate: number  
> The maximum number of particles to emit per frame

There are also some other properties that might be useful, namely

> manualEmitCount: number  
> If you want to launch only a few particles at once, that can be done, as well.

And _updateSpeed_.

Not sure if or how these properties work.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 21, 2025, 10:51am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/9 "2025-01-21T10:51:26Z")

</div>

Does this help?

> [@GPU particles and targetStopDuration](https://forum.babylonjs.com/t/gpu-particles-and-targetstopduration/51739/30):
>
> So! Actually everything works as expected but it is a bit complex to understand slight_smile Some prerequesites: GPU particles are not created. The system has a define pool and only iterate through them. Dead particles are recycled and new ones are built from the same structure. For instance the system creates a buffer of 100 particles at start and the GPU goes through all of them every frame. It updates every particles and then render the same buffer. At the beginning until we reach max c…

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 21, 2025, 4:55pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/10 "2025-01-21T16:55:01Z")

</div>

That does not answer the fact that each iteration the emission count starts going up.

If its the dead particles being displayed then why are they not displayed at the start? If they have the ability to be hidden completely when dead then they should be just like at the start. It seems more like the emission rate is compounding.

If I set my emission rate to 1, it should stay at one… its rate should not increase, the number of living particles should only added to by the rate of emission not the rate of emission plus dead particles…

If I start a system at a rate of one and then come back 10 mins later and its emission rate is at a couple thousand that is incorrect.

> **[Babylon.js Playground](https://playground.babylonjs.com/#1ASENS%23378)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

You can see here in @HiGreg’s example that each emission cycle the counts are going up. It should only emit one particle each emission cycle. Not +1 each time.

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [January 22, 2025, 12:36am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/11 "2025-01-22T00:36:50Z")

</div>

I’m not sure what you mean by “should.”

The relevant code within GPUParticleSystem is within render(), so this happens each particleSystem “frame”:

```
    this._accumulatedCount += this.emitRate * this._timeDelta;
    if (this._accumulatedCount > 1) {
        const intPart = this._accumulatedCount | 0;
        this._accumulatedCount -= intPart;
        this._currentActiveCount += intPart;
    }

    this._currentActiveCount = Math.min(this._maxActiveParticleCount, this._currentActiveCount);

    if (!this._currentActiveCount) {
        return 0;
    }

```

Where **this.\_maxActiveParticleCount** is from the **capacity** parameter to constructor.

In words, each render call \_accumulatedCount is increased by updateTime \* emitRate and when that value is strictly greater than one, the number of activeParticles is increased by that amount until the there are **capacity** number of active particles. The number of active particles is the number in view (generally). When a particle dies, a new one takes its place automatically, keeping the number of active particles constant.

The emitRate, then, is proportional to the increase in active particles on each step.

Looking through the code I discovered you can increase the number of new particles using _\_accumulatedCount += numberOfNewParticles_. As long as numberOfNewParticles is _strictly greater than one_ (1.1 works if you need one particle). If you just want to set the number of particles, then also set emitRate to 0. I don’t see **manualEmitCount** actually implemented. Arguably, it should set \_accumulatedCount internally on the next render() (then reset itself to 0), but doesn’t. Also, the code should perhaps check for \>= 1 rather than \> 1 so that one particle woukd be created.

Another function I can think of you _might_ want to do is to add a new particle that goes away when it dies, instead of being replaced. I don’t see how to do that currently.

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [January 22, 2025, 12:51am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/12 "2025-01-22T00:51:18Z")

</div>

I would add that this is not intuitive functionality to me. But I haven’t played around with it enough to strongly recommend making it “intuitive to me.” I might take a shot at proposing an alternative and figuring out if that alternative can be implemented without a breaking change.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 22, 2025, 1:07am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/13 "2025-01-22T01:07:55Z")

</div>

That is inherently wrong by particle systems is what I am saying. For example if I go into Unity and spin up a particle system, set the rate to 30 (not single burst but continuous) then every emission cycle it will emit 30 more particles until it hits system capacity. It does not emit 30 particles for one second then 60 for the next then 90 the next and so on.

Im just going to have to look at the code and see when there is time here. There is no reason to set an emission rate of one (with the assumption that it is then one per second) and a lifetime of one second on the particles for there to ever be more than one visible. That is inherently incorrect and the fact it eventually goes to emission rate = to the system capacity on each emission cycle would infer that emission rate is not an emission rate but an accumulation of emission rate.

All in all if I set an emission rate of one and a lifetime of one on the system for the particles, I should be able to walk away and come back to the same visual results. Yes, I could limit the system to one particle in this dumb example but that does not fix the actual problem.

> **[Babylon.js Playground](https://playground.babylonjs.com/#1ASENS%23381)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

You can see here how particle systems should behave. Them being GPU particles they should still respect the emission rate.

---

<div class="post-metadata">

**Author:** ![HiGreg](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@HiGreg](https://forum.babylonjs.com/u/HiGreg)\
**Post date:** [January 22, 2025, 2:21am UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/14 "2025-01-22T02:21:53Z")

</div>

I see what you are saying, and the ParticleSystem implementation makes more sense than the GPUParticleSystem. It’s not immediately clear how to fix GPUParticleSystem. The relevant lines for ParticleSystem are in the ThinParticleDystem.ts file. One relevant line for GPU is in

[Shaders/gpuUpdateParticles.vertex.fx](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Shaders/gpuUpdateParticles.vertex.fx) lines 184-:

```
// If particle is dead and system is not stopped, spawn as new particle
if (newAge >= life && stopFactor != 0.) {
    vec3 newPosition;
    vec3 newDirection;
    .
    .
    .

```

To minimize the need to go back to CPU, lifetime might need to be managed by the GPU in the shader. But it’s not clear whether this works well with the current split of code/data between CPU and GPU. If particles die when age\>lifetime, then the CPU updating the uniform buffers is much more difficult because “buffer of alive particles” is not contiguous. I’d be interested to see what updates you recommend!

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 23, 2025, 4:34pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/15 "2025-01-23T16:34:37Z")

</div>

@Deltakosh I think you did the GPU particles right? Can we get some input on maybe where on the chain to look to get this to emit in the same manor as the non GPU particles?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 23, 2025, 5:05pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/16 "2025-01-23T17:05:25Z")

</div>

> [@HiGreg](#):
>
> -

Sorry but I did not read the entire thread because I’m in a rush. but GPU particles does not work the same way CPU particles do. (You may have noticed it)

On every frame the system increase the active buffer size. Precisely the active particle count:  
[Babylon.js/packages/dev/core/src/Particles/gpuParticleSystem.ts at 718f4376127a669a44a82f5b64fac772f95bb1b5 · BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/blob/718f4376127a669a44a82f5b64fac772f95bb1b5/packages/dev/core/src/Particles/gpuParticleSystem.ts#L377)

this number is used to define how many particles are drawn:  
[Babylon.js/packages/dev/core/src/Particles/gpuParticleSystem.ts at 718f4376127a669a44a82f5b64fac772f95bb1b5 · BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/blob/718f4376127a669a44a82f5b64fac772f95bb1b5/packages/dev/core/src/Particles/gpuParticleSystem.ts#L1730)

Hence why at the beginning there is one particle then 2 (because GPU particle works that way: the emit rate is the number of new particles): [Babylon.js/packages/dev/core/src/Particles/gpuParticleSystem.ts at 718f4376127a669a44a82f5b64fac772f95bb1b5 · BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/blob/718f4376127a669a44a82f5b64fac772f95bb1b5/packages/dev/core/src/Particles/gpuParticleSystem.ts#L1858)

There is no notion of dead particles. They get recycled into new ones because the GPU system does not support NOT rendering them

This is something we could add but it is not yet supported. We could discard the fragment when a particle is dead

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 23, 2025, 5:17pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/17 "2025-01-23T17:17:14Z")

</div>

We probably should, it effectible makes GPU particles systems useless for sustained systems. Its not a problem for one shots, but for long term systems its not going to cut it. (unless there is some magic prop that I don’t understand and am not using).

Its weird that the system can start with hidden particles, but cant hide them on death later.

Thanks for taking the time to look into this with me \<3.

I basically would love to leave a GPU particle system alone and the next time I look at it, it be the same as when I left it.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 23, 2025, 5:31pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/18 "2025-01-23T17:31:16Z")

</div>

> [@Pryme8](#):
>
> Its weird that the system can start with hidden particles, but cant hide them on death later.

They are not hidden, they are not yet alive. They are not rendered at all. Once the buffer is in you cannot go back without losing all perf

The thing is that if you want 1 part at the time you need to set it to one manually. and done. So it will emit only one part forever

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [January 23, 2025, 5:42pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/19 "2025-01-23T17:42:58Z")

</div>

Ohhhhhh, ok so for a long term GPU system then its like “one shot” on the spawning and then it will just recycle them?

Interesting. I can probably make them work just have to shift how they are constructed.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [January 23, 2025, 5:59pm UTC](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087/20 "2025-01-23T17:59:23Z")

</div>

let me get a demo for you

[Next page](https://forum.babylonjs.com/t/gpu-particle-systems-emitting-increase-over-time/56087.md?page=2)
