GPU particles and targetStopDuration

It looks like targetStopDuration isn’t working properly for GPU particles.

After stop duration active particles keep “floating” around, instead of being disabled.

There is also some possibly related issue with re-starting the system, which doesn’t seem to work unless doing something like

ps["_actualFrame"] = 0;

Check this PG:

cc @sebavan

You have to dispose the GPU particles manually if you want them to disappear.

I created this PR to notify the onStopped observers for the GPUParticleSystem.

So you can:

    gpuPS.onStoppedObservable.add(() => {
       // do whatever you want

Thanks @roland, will try that out when available.

However not sure I understand how this will work with targetStopDuration? I don’t want all particles to be removed at this time, but rather that no more are emitted, and that existing active particle follow the lifespan.

It looks to me that with GPU particles, at targetStopDuration, it stops emitting new particles, but also “freezes” existing particles, so that they no longer follow their lifetime?

Like this?

Yes exactly, but that doesn’t seem to work in my PG (never mind the mouse handling, just on initial particle activation) - the active particles seems to live forever :S

Could that be because I load from snippet server?

I don’t know but I’ll do a test. :wink:

I’ve saved the PS from my last PG to the snippet server.

There are no issues when using it from the snippet server. I suspect some of the values you’ve entered into your PS config are not playing well together. Try to create one from scratch :slight_smile:

Okay I started from a new PS, just adding from inspector (CPU system).

  • changed emitter to hemisphere
  • changed min/max size
  • changed targetStopDuration

doesn’t work right on GPU :S

Here is PG with both GPu/CPU at same time:

1 Like

Did more testing … seems this happens with hemisphere emitter

1 Like

Here I started with a GPU system and only tweaked targetStopDuration:

I then change emitter to hemisphere, and thing breaks:

1 Like

I added the hemispheric emitter by code and it also breaks the PS…

I exported bith GPU PSs to JSON (w and w/o hemispheric emitter), compared them and there is really nothing else different.

Let me add @Deltakosh the particles daddy to the party as I bet he ll find it in less time I need to write this :slight_smile:

Please bear with him, as he is in vacations until next week.


Thanks, lemme know if there is anything I can do to help.

And what a cool title: “Particle Daddy” :smile:

Another particle related question: how do I set particle rotation so it matches their velocity, i.e. the direction they are emitted or “flying” at?

Please, start a new thread for new questions so that we can keep this one for the bug, thanks :slight_smile:

Sure: Orient particles along their velocity

ok help me reconnect with that thread :slight_smile:

What is the problem highlighted by your PG?

(I must be slow, I caught COVID ;))

With the default cone emitter everything is fine, targetStopDuration works as expected.

However with e.g. a Hemisphere emitter, it looks like at targetStopDuration no more particles are emitted, but existing active particles are “frozen” and do no longer live out their lifecycle

1 Like

I have the same problem, when I change from CPU to GPU particle system - targetStopDuration not working.

(defn explode [emitter]
  (let [ps (create-particle-system {:name "explode"
                                    :gpu? true
                                    :particle-texture (api.asset/get-asset :texture/explode)
                                    :emitter emitter
                                    :color-gradients [[0 (api.core/color-rgb 179 26 208 255)]
                                                      [0.5 (api.core/color-rgb 104 100 255 255)]
                                                      [1 (api.core/color-rgb 255 10 152 255)]]
                                    :min-size 0.1
                                    :max-size 0.5
                                    :emit-rate 1000
                                    :target-stop-duration 0.08
                                    :min-life-time 0.3
                                    :max-life-time 1.5
                                    :min-emit-power 1
                                    :max-emit-power 3
                                    :update-speed 0.05})]
    (j/call ps :createSphereEmitter 0.1)