I have completed my implementation of the spatial hash structure for particles and the result was not impressive at all. Without handling hashing collisions (a hashing collision is when two different domain particles are assigned to the same spatial bucket) the performance gain is not constant and very small compared with the current kdtree but error prone, and with hashing collision handling the performance generally is slower … I was suspecting that the current spatial structure is not the current performance bottleneck of particles, so improving it could lead to small gains.
My conclusion is that implementing the spatial hashing is not worth right now, this research time though seems lost is not, I have learned quite a lot in the process and I get an important conclusion to keep moving in the future 😉
Of course, there are many spatial hashing implementation possibilities and I may have not tested an optimal one, I have noted that with the hash the fluids seem more smooth than with kdtree … an intriguing situation that speaks about kdtree leaving outside influential particles in fluid motion, but not a serious issue right now.
The Blender GHash module didn’t fit, because it use pointers as keys and I need values as keys, and still I have learned to use this handy tool.
Hashing is often overlooked but is very powerful.
I have started to write down the particle fluids wiki, I spend the whole day editing the page, and basically copy/paste with some pictures upload , but as you can imagine for my internet connection it was like a hell. Hours to set up a wiki page that otherwise could take several minutes! Anyway, as soon as i get connected again I continue updating it and adding the fluid particles related pages.