Hey there!
The title is confusing and this is probably another fuse-newbie question :D But I hope that I can explain my problem more in-depth here and that it helps other people with other related problems (like finding an average position of their particles).
In my main patch I have a particle system with around 1M particles which arrange in somewhat unpredictable ways. My current idea was to get a bounding box of the particles so I can then automatically position a camera to capture all of them reliably.
I have attached a minimum working example down below of my current approach. This just scatters them in a cube and moves them around a bit. The whole camera thingy doesn’t really apply here (but it does in the main patch)
Right now, the patch does this:
- Read back a fraction of the particle positions to the cpu
- Loop over them and accumulate min and max positions (they need to be initialized with fairly high values outside of the actual bounds (100,100,100 in this case). If all particles are above 0,0,0 this function would return that instead of the actual particle minimum for example)
This of course has a few drawbacks:
- it runs on the cpu and is slow as hell with everything else going on in the main patch
- I can only use a fraction of the total particles before it starts lagging. This isn’t that bad if you don’t need 100% accurate results. It might also be okay to do this asynchronously in case you don’t need to update the bounding box for every single frame.
My preferred solution would ofc be to do this stuff on the GPU. I just don’t have a clue on how to do that. Everything I have tried thus far has resulted in the program crashing :D
Maybe there is a smarter way of doing this entirely. Maybe by updating a min and max position variable during the simulation stage instead of finding it afterwards. Heck, there might even be an obscure node to do this directly.
MinMaxPosition.vl (53.3 KB)
Feel free to ask if you have any questions about what I’m trying to do.
And thank you so much in advance!