I want to create a module for kill particles that will kill/cull any particle that is a certain distance from its nearest particle.
I’m using a depth map to generate particle location but the if there is noise in the texture it generates rogue particles in the negative space where I don’t want them. so the best way would be to make a module and if any particle is x distance away from its closest neighbor then it kills it.
For every particle to get data about where every other particle is, it would be very expensive to implement (it’s an n-squared operation.)
It’s also quite hard to do on the GPU (it would need a very long loop per particle, and GPUs don’t like long loops.)
I recommend you find some other way to do it. Can you read your depth map to figure out whether to kill a particle after the fact?