We found that rendering the particles and the movements was quite slow. We then did more researches on possible optimization for faster the system. We then found the Spatial Hash Grids method, which can improve the neighborhood search and sorting in SPH algorithm. This optimization method was outlined by a tutorial paper on implementing the SPH algorithm [1] and was used by Sebastian in his video of speeding up the rendering time [2]. With optimization, the SPH fluid algorithm reduced the runtime complexity of O(n2) to O(mn), where 𝑚 represents the highest number of neighboring particles. The illustration of the Spatial Hash Grids is shown below in Figure 1.
Then, our used GPU instancing, which processes multiple instances in parallel on the GPU to improve rendering efficiency. We retrieved particle positions and velocities from the buffer and map colors based on particle velocity, using a gradient from deep blue to white to represent low to high velocities. The rendering setting we used is shown below in Figure 2. The finally rendering effect shows in Figure 3.
[1] Green, S., 2010. Particle simulation using cuda. NVIDIA whitepaper, 6, pp.121-128.