Particles receive wrong values when using curves

Let’s say that I want to have an emitter of time X, where a single particle has a lifetime of Y. Let’s also add to that, that I want the particle to fade out with time. Emitter spawns the particles for whole it’s duration (which is X). As a result, there will be a moment when the emitter duration is “finished” and there will be still some particles alive (because they spawned just before the emitter duration ended and “ParticleSpawnTime + Y > X”).

The expected result is that the remaining alive particles gently finish their life by continuing to fade away, just as their interpolation parameters tell them to. Once they all fade out and die (LastParticleSpawnTime + Y) the emitter may reset and loop (if needed).

What happens, is that as soon as the emitter duration X kicks in, all the alive particles (regardless of their inner state) are forced to alpha == 1.0f, and are all visible, even if they should not be. What the user observes is a instantaneous visibility of all the particles, which is not what the creator of the effected wanted. Then they proceed to function as if their lifetime just started and was reduced by the time they were already alive, to match the duration Y that was set in cascade.

Example (all the times are in seconds):

Emitter Duration: 5 |
Particle Duration: 2 |
Particle set to fade out to 0 at the end of it’s lifetime.

Particle Spawns at time 4. It fades out until time 5, when it is at 50% visibility. Next frame it gets popped to 100% and keeps fading out from 100%. As to how it does that I am not certain, either it is

At time 5.5 it is at 50% opacity. At time 6 is is at 0% and dies.

or

At time 5.5 it is at 75% opacity. At time 6 is is at 50% and dies.

Doesn’t look well either way. I’ve searched a bit and found this:

After a quick browse of the 4.10 code, the line has the FMath::Clamp added. I suppose that might be responsible for some of the other issues I’m seeing (and I’d like an update on the one I linked above as well) but the bug I am reporting I have reproduced in binary versions 4.6, 4.7, 4.8, 4.10 and is broken everywhere (yes, I skipped 4.9, but my bet is that it’s broken there too). Did not migrate, every single time created from scratch. I’m attaching a sample project, one made for 4.6 which you can migrate to any other version and notice the same effect on the particle there.

To see the effect clearly, place the particle on a map and press ‘Spacebar’ (reset in level), so it plays one loop on the scene. You will see the popping behavior without having to think whether it is cascade preview window loop or not.

Hi vipeout -

With the setup you have given me you will want to set the Dynamic Module to Spawn Time Only = true. Otherwise you are telling the system that at each tick between 0 and 3 to update all values of all particles whether they have just spawned or are about to die. For the look you are wanting however you would want to set that value at Spawn and let the particle live out its life based on the 0 to 3 without ever being updated again by the system.

Thank You -

Eric Ketchum

Thank you for the quick answer, works as expected.