So for me this is one of the big features that are missing in the particle system. Being able to set a random life time will make particles a lot more dynamic and "realistic" to look at, especially explosions. This has been adressed in previous tracker issues here: #6377, #20473
There is actually a random function in the particle systems but it's not doing anything at the moment, at least not on my screen :)
Reproduce: Make a particle system, set Explosiveness to 1 (all particles will die at the same time). Set randomness to 1 or 0, it has no effect.
The issue is present in all particle systems: Particles2D, Particles and CPUParticles.
What about setting the particle's lifetime randomly when it starts emitting?
However, note that the number of particles displayed at a given moment depends on the lifetime, so you will also need to adjust the number of particles.
The randomness property already does this.
_"The randomness property already does this."_
@Calinou @TheDuriel - Did you actually test this or is it just a guess? I wrote that setting Randomness to 1 has no effect for me, so maybe you could elaborate a bit on how you get it to work.
This has been suggested several times in the past, and it is surprising that it hasn't been added yet. You are quite correct that having the explosiveness on 1 means that all particles emit at once and have the same lifespan. It does indeed look bad for an explosion, as all particles die at the same time, which looks very unnatural. Unless something has changed since 3.0.6, the randomness option will not give a random lifespan.
I did have a go at editing the default particle shader to allow this, but it eluded me. Editing the particle shader is not exactly a simple thing! Would be great to get this working...
Just for the reference, setting explosiveness to e.g. 0.9 allows for better explosion effects in my experience, as you then get particles emitted close to each other but not at the exact same time, so they also disappear gradually.
Still, actual random lifetime would be nice, but I'm not sure how hard it would be to implement, as the whole particle system is built around phases (current delta % lifetime).
@akien-mga You are right about the explosive value, I have experimented with it myself and have often used a value close to 0.9. - But yes.. it's not as nice as random lifetime.
@akien-mga yes that was my only solution as well! Combined with script instanced planes and meshes that emulate particle motion you can get some decent explosions.
I am hoping that eventually post 4.0 an enterprising dev will work on a node based particle system in Godot. The particle system in Godot is probably the weakest part of the toolset for me. Interestingly,, Jacques Lucke has been adding commits to the Blender functions branch in recent weeks for a new node based particle system. So hopefully this may inspire someone in the Godot community :)
The whole point of randomness is to randomize the lifetime of particles. It is definitely not doing that right now. Even with randomness set to 1 all particles die at the same time. I can't even see a difference when changing randomness value.
_edit:_ After investigation, it appears that we all are facing some misconceptions about what randomness does. It randomizes the emission of each particle _within_ its phase. To understand this, consider a regular particle system with ten particles with explosiveness of 0. Each particle would be emitted and destroyed at time (particle_num)/10.0 (i.e. 0.0, 0.1, 0.2, 0.3...). The "phase" in this system is0.1settingrandomnessimpacts when the particle emits within that phase. So withrandomnessset to1in this example you may end up with an emission sequence like 0.02, 0.15, 0.27, 0.31. Each particle is restricted to its phase, but is randomized within it. When particles useexplosiveness`` the concept of phases loses value, and all particles end up emitting and dying at the same time.
So contrary to my previous comment, randomized lifetime would be a new feature and should be added.
Thanks for the excellent explanation @clayjohn. I agree that randomised lifetime is a must have feature.
Most helpful comment
This has been suggested several times in the past, and it is surprising that it hasn't been added yet. You are quite correct that having the explosiveness on 1 means that all particles emit at once and have the same lifespan. It does indeed look bad for an explosion, as all particles die at the same time, which looks very unnatural. Unless something has changed since 3.0.6, the randomness option will not give a random lifespan.
I did have a go at editing the default particle shader to allow this, but it eluded me. Editing the particle shader is not exactly a simple thing! Would be great to get this working...