Jump to content

[SOLVED] ParticleSystems in a hierarchy don't seem to honour the Sequence parameter


photo

Recommended Posts

Posted

PFA the particle system in question.

 

The required effect is that muzzle flash, smoke and the shot for a weapon should all be created at exactly the same time.

So I put them all as children of a dummy particle system and set all their 'Sequence' as 0 (I also tried all of them having value 1)

In spite of this the particles are not generated at the same time, I also made sure that the Delay, Period and Duration values are the same for all of these.

 

Thanks,

Ashwin.

acid_shot_temp.zip

Posted

You can take a look at how shorts are created in the library/worlds/sfx/artillery_shot.

  • First of all, you need to set a Period for the root node to generate all child particles not once (when inf), but repeat with a 3 seconds pause.
  • In the child particles, set Duration to 0.1 seconds, if you want spawning to be short-time.
  • Then we can go over to the Spawn rate of child particles. It sets a number of particles per secons. So if we want to generate at least some particles during our 0.1 second, we need to set the Spawn rate to 15-20 particles (for the guarantee).
  • If necessary, you can also limit the number of particles per frame.

Attached is your node tweaked according to the mentioned above.

acid_shot_complete_ed.node

Posted
  • First of all, you need to set a Period for the root node to generate all child particles not once (when inf), but repeat with a 3 seconds pause.

Why do we need to set a period like 3 seconds? And how did you arrive at that figure? 3 seconds sounds arbitrary to me. Looking at the particles system, I'd imagine that if the period is set to "inf" then all child particle systems would spawn their particles and then spawn no more. And for our requirement we need an "inf" period so that the system completes exactly one cycle.

 

 

 

In the child particles, set Duration to 0.1 seconds, if you want spawning to be short-time.

 

Here again, the documentation is unclear. If the duration is 0.1 and the Spawn Rate is 1, will 1 particles be spawned at the *beginning* of the 0.1 second time slice or at the end of the time slice?

If it's the beginning i.e, if Period=inf, Duration=0.1, Spawn Rate = 1 oone particle will be spawned when I call setEmitterEnabled(1), correct?

  • Then we can go over to the Spawn rate of child particles. It sets a number of particles per secons.So if we want to generate at least some particles during our 0.1 second, we need to set the Spawn rate to 15-20 particles (for the guarantee).
     
     
    Again I find the 15-20 spawn rate arbitrary. How was this figure arrived at? This really doesn't fit our purpose where we want exactly 1 particle to be emitted every time we call setEmitterEnabled(1)

If necessary, you can also limit the number of particles per frame .

 

 

If I understand right, "Limit" limits the number of particles emitted per frame, not the total number of particles in existence. E.g. I just set the limit to 1 and found that it was still emitting two particles while I wanted exactly one particle. I am guessing this is because the spawn rate was the arbitrary 20 figure.

 

Our usage pattern is this:

1. Create an ObjectParticles node and call setEmitterEnabled(0)

2. Since timing is important to us, call setEmitterEnabled(1). Since the period of the parent-most particles system is "inf" all the child particle systems emit particles for one cycle and stop emitting.

3. When we need to show the particles next time, call setEmitterEnabled(0) follwed by setEmitterEnabled(1) just like in the editor.

 

Unfortunately this doesn't seem to work the way we expect it to. Sometimes more particles are emitted than what we want, sometimes the effect is delayed and so on.

Maybe we are not doing it the right way, but I couldn't find another way to "reset" the particlesystem just like one would reset an animation by setting it to frame 0.

 

I am attaching another fx which should illustrate my problem better

Load this fx, muzzle_timing into the editor and select the parent-most particle system.

Now Uncheck the Emitter Enabled checkbox and Check it again.

The system will run for one cycle.

Do this again and again. You'll find that sometimes the child particles get generated first and at other times the parent particle get generated first, in spite of having set the parent's sequence to 0 and the children's to 1.

muzzle_timing.node

Posted

Why do we need to set a period like 3 seconds? And how did you arrive at that figure? 3 seconds sounds arbitrary to me.

Yep, that's an arbitrary one, set just for convenience when setting up the effect. If you need only one cycle (when the emitter is enabled), 'inf' is what needs to be used, you are absolutely right here.

 

If I understand right, "Limit" limits the number of particles emitted per frame, not the total number of particles in existence.

Yes, you are right, per frame.

 

If the duration is 0.1 and the Spawn Rate is 1, will 1 particles be spawned at the *beginning* of the 0.1 second time slice or at the end of the time slice?

The idea is: let's say you set Spawn to 1 particle per second, and Duration to 0.1, and the Period to 1 second to be iterative. Once the emitter is enabled, it counts off Duration intervals (Period time is ignored) and when they make in sum 1, a particle is spawned. If we have 2 particles, they are simulated somewhere throughout this accumulated 1 second period.

 

So, if you have 'inf' Period, Spawn = 1 and Duration = 0.1, you will simply get not enough time accumulated. No particles will be spawned in this case.

 

You'll find that sometimes the child particles get generated first and at other times the parent particle get generated first, in spite of having set the parent's sequence to 0 and the children's to 1.

I've consulted with our artists again and they suggested a new adjustment scheme. To perfectly control how much particles are spawned:

  1. Set Duration to 0. This would mean that particles are spawned over an infinitely small time interval (one frame, that equals one shot in your case).
  2. Set Limit to 1 particle. When Duration = 0, it would control how many particles are spawned at once, during this one frame.
  3. Set Spawn rate to 100000 to generate a particle (for sure!).

Check how gun shots are created in demos/passage/agent/nodes/plasmagun_shoot.node. It is exactly what you need. With Duration time of 0, different particle systems will also be synchronized.

Posted

Thanks a lot manguste, this has helped us a lot :D

 

I have a working version now, which I've modeled according to your advice, but there are still some open points I'd like to wrap up.

In the attached node muzzle_timing.node, I've closely followed your plasma_gun effect but that didn't initially give me the desired effect.

For the *parent* I set Duration=0 Limit=1 SpawnRate=inf/100000 and I could see that it would generate exactly one particle every time I enabled it.

But the children were behaving erratically. I copied your plasmagun_shoot effect and saw that all children had Duration=inf and Period=0 so I did the same for the children of my parent node as well.

But the children were not spawning particles reliably if the SpawnRate was below 100.

 

You can check the attached node, you'l see that if you put the spawn rate of the children as, say, 5 - no particles are emitted.

How can we find out this minimum value of spawn rate for children? Or should we just keep it really high and use the Limit paramter?

 

Thanks again!

Posted

Usually we set the parent particle system as an dummy one, with non-zero Duration time. This duration time interval should cover all duration intervals and delay intervals (if any) of the children particle systems. Then in the child particle you set any Duration time you need (but it should be smaller than the parent one!).

 

So, the idea is one dummy parent (its spawn rate does not actually matter, you can even disable its surface) and child particle systems with necessary parameters (Duration=0 Limit=1 SpawnRate=inf/100000).

Posted

Thanks pluton, it all makes sense now :(

Though I'd suggest adding this to the documentations as a 'trick' because it's almost impossible to figure out otherwise.

 

Thanks!

×
×
  • Create New...