Hey guys, this is probably the complete wrong way to go about things but I’m making a particle simulator and I want each particle to know about its nearest neighbors. From what I can tell the usual way to do this is to split the simulation space into a grid of cells and only loop through the particles of the cell it’s in and neighboring cells.
The problem is that since I’m so new to compute shaders and thus HLSL, I’m unsure how I can implement this. I was going to have a Cell struct with a dynamic array where I can chuck all the particles in, but I don’t know how to have custom typed arrays and I don’t think it’s possible to have dynamic arrays in a shader?
I was told to look into quadtrees but from the few resources I could find on Google I’m having hard time wrapping my head around implementing it in shaders.
I’d greatly appreciate any advice you guys have, and please let me know if this is entirely stupid and incorrect.