How to retrieve neighboring particles around a specific particle?
#1
Hello,

I have a set of 10,000 particles (generated from a Voronoi fracture). Every 25 frames, I send one particle to another event. I call this particle the "master particle".

In this new event, I want the master particle to affect all neighboring particles within a given radius, but I can't figure out how to do this.
My current workaround is to assign a custom float or a group to the master particle, then run a Neighbor Test on all 10,000 particles in the first event. It works, but it's very slow because it has to check every particle.

I also tried using clustering, but I couldn't get enough control over which particle becomes the master particle.
   
I also tried using the Bind Particle operator, thinking I could use the bound particles to propagate the effect. Unfortunately, the bound particles don't seem to be affected either, so this approach doesn't solve the problem.

I was hoping that Transfer Properties to Neighbors or Set Target (By Proximity) would work, but these operators seem to work in the opposite direction of what I need.

Am I doing something wrong or do I forgot something? 
Is there a more efficient way to retrieve all particles within a given radius of a specific particle?

I'm considering writing a TyScript solution for this, but I also wanted to ask if there's already a built-in operator or workflow that achieves this.

Thank you!
  Reply
#2
This is a very specific problem that would likely be best solved by a Script operator. Basically for a given particle in your event, you'd scan all other particles and if they're within range you assign your given particle as their target. Perhaps there's some way to wrangle this with regular operators (ex: Set Target), but you're likely going to want more control than what's offered by default.
  Reply
#3
Simone Nastasi recreated in TyFlow "Dynamic activation system" from Alesandro Nadini setup in Houdini that was used in For Honor cinematics.

The whole setup kind'a reminded me of your question... but I might be wrong..

Check out his tut... at least.. maybe it will give you some ideas how to solve it without scripting.

https://youtu.be/rr0Mn_S9kH8?si=QlSWUd2UeAkgoxOK
  Reply
#4
Thank you,

I wrote something who run suffisently fast for my need, also, I'm thinking to add a pearl noise to make a my radius selection looking like a splats rather than a circle
The script operator is nice.

int chunkIdInt = 0;
public void simulationStep()
{

for (int i = 0; i<eventParticleCount;i++)
{
int sInx = tf.GetSimIndex(i);

if (tf.GetCustomFloat(sInx, "isMaster")<=0.0f)
{continue;}

chunkIdInt ++;
tf.SetCustomFloat(sInx, "chunkId", (float)chunkIdInt);
float custF = tf.GetCustomFloat(sInx, "chunkId");
float radius = tf.GetRandFloat(sInx, 0.5f, 1.0f);
Point3 masterPos = tf.GetPos(sInx);
for (int j = 0; j<eventParticleCount;j++)
{
if (j==i)
{continue;}

int sInxTemp = tf.GetSimIndex(j);

if (Point3.Distance(masterPos, tf.GetPos(sInxTemp)) < radius )
{
tf.SetCustomFloat(sInxTemp, "target", sInx);
tf.SetCustomFloat(sInxTemp, "chunkId", (float)chunkIdInt);
tf.TestTrue(j);
}

}
tf.TestTrue(i);
break;
}
}
  Reply


Forum Jump: