multi-thread control

Discussions about SOFTIMAGEs© Interactive Creative Environment©
christophklemmt
Posts: 3
Joined: 09 Apr 2015, 08:45

multi-thread control

Post by christophklemmt » 05 Jun 2015, 16:35

Hello

I am trying to control the spawn behaviour of particles in a way so that during one frame, neighbouring particles cannot spawn:

Image

In the upper part I am defining some rule which set's a particle's self.willSpawn to true or false, for my question it doesn't matter how this is set.

In the lower part, I am attempting to set self.willSpawn to false if any of the particle's neighbours have self.willSpawn set to true. The IDs of the neighbouring particles are stored in self.pnl.

This appears to work, but not always, sometimes I still get neighbouring particles spawning in the same frame. I then took the complete lower part and made a copy of it which I plugged into the execute port 3. So I am basically repeating to remove particles if any of their neighbours is spawning. The result is that the amount of errors is significantly lowered, but after some time I will still get it that two neighbouring particles spawn in the same frame.

My assumption is that this is caused by the multi-threading: The upper part, which sets the initial self.willSpawn for each particle, has not been completed yet for all the particles, while some particles already start to check if any of their neighbours will spawn. Could this be the reason for my errors? Is there a way to enforce that the upper part is completed for all particles before the lower part is executed for any particle?

Thank you!

Christoph

luceric
Posts: 1252
Joined: 21 Jun 2009, 22:08

Re: multi-thread control

Post by luceric » 05 Jun 2015, 20:28

AFAIK the execute ports on the terminal node are run one after another and not in parallel, if what's what you are suggesting.