journal article·2025-09-03Open access

Moving Towards Large-Scale Particle Based Fluid Simulation in Unity 3D

Muhammad Waseem, Min Hong

Applied Sciences· Volume 15· Issue 17

Abstract

Large-scale particle-based fluid simulations present significant computational challenges, particularly in achieving interactive frame rates while maintaining visual quality. Unity3D’s widespread adoption in game development, VR/AR applications, and scientific visualization creates a unique need for efficient fluid simulation within its ecosystem. This paper presents a GPU-accelerated Smoothed Particle Hydrodynamics (SPH) framework implemented in Unity3D that effectively addresses these challenges through several key innovations. Unlike previous GPU-accelerated SPH implementations that typically struggle with scaling beyond 100,000 particles while maintaining real-time performance, we introduce a novel fusion of Count Sort with Parallel Prefix Scan for spatial hashing that transforms the traditionally expensive O(n²) neighborhood search into an efficient O(n) operation, significantly outperforming traditional GPU sorting algorithms in particle-based simulations. Our implementation leverages a Structure of Arrays (SoA) memory layout, optimized for GPU compute shaders, achieving 30–45% improved computation throughput over traditional Array of Structures approaches. Performance evaluations demonstrate that our method achieves throughput rates up to 168,600 particles/ms while maintaining consistent 5.7–6.0 ms frame times across varying particle counts from 10,000 to 1,000,000. The framework maintains interactive frame rates (>30 FPS) with up to 500,000 particles and remains responsive even at 1 million particles. Collision rates approaching 1.0 indicate near-optimal hash distribution, while the adaptive time stepping mechanism adds minimal computational overhead (2–5%) while significantly improving simulation stability. These innovations enable real-time, large-scale fluid simulations with applications spanning visual effects, game development, and scientific visualization.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Fluid Dynamics Simulations and Interactions · Computer Graphics and Visualization Techniques · Fluid Dynamics and Heat Transfer

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Software Convergence, Soonchunhyang University, Asan-si 31538, Republic of Korea

Department of Computer Software Engineering, Soonchunhyang University, Asan-si 31538, Republic of Korea

Funding

National Research Foundation of Korea (NRF) · BK21 FOUR · Soonchunhyang University Research Fund

References (45)

Show source-provided references
1. Frost, B., Stomakhin, A., and Narita, H. (2017). Moana: Performing Water. ACM SIGGRAPH 2017 Talks, Association for Computing Machinery.10.1145/3084363.3085091 ↗
2. Gilbert, M., Kuenzel, J., Campbell, K., Gladstone, G., Kalache, J.C., de Goes, F., and Barry, J. (2023). Elemental Characters: Bringing Water to Life. ACM SIGGRAPH 2023 Talks, Association for Computing Machinery.10.1145/3587421.3595449 ↗
3. Surface Tension and Wettability Calculation Using Density Gradient Potential in a Physically Consistent Particle Method10.1016/j.cma.2021.114072 ↗
4. Huang, H., and Yi, L. (2024). Journey into SPH Simulation: A Comprehensive Framework and Showcase. arXiv.
5. Using a Compute Shader for an Adaptive Particle System10.23939/mmc2024.01.001 ↗
6. Efficiency and Scalability of Fully-Resolved Fluid-Particle Simulations on Heterogeneous CPU-GPU Architectures10.1177/10943420241313385 ↗
7. MacRaild, M., Sarrami-Foroushani, A., Lassila, T., and Frangi, A.F. (2024). Accelerated Simulation Methodologies for Computational Vascular Flow Modelling. J. R. Soc. Interface, 21.10.1098/rsif.2023.0565 ↗
8. Waseem, M., Taeheon, K., and Min, H. (2025, January 25–27). Real-Time Particle-Based Fluid Simulation. Proceedings of the International Conference on Computation, Big-Data and Engineering, Kuala Lumpur, Malaysia.
9. Hrytsyshyn, O., Venherskyi, P., Trushevskyi, V., and Terletskyi, O. (2023, January 26–28). Smoothed Particle Hydrodynamics Implementation Using Compute Shaders. Proceedings of the 2023 IEEE 13th International Conference on Electronics and Information Technologies (ELIT), Lviv, Ukraine.10.1109/ELIT61488.2023.10310973 ↗
10. Optimizations for Predictive–Corrective Particle-Based Fluid Simulation on GPU10.1007/s00371-021-02379-w ↗
11. A Numerical Approach to the Testing of the Fission Hypothesis10.1086/112164 ↗
12. Smoothed Particle Hydrodynamics: Theory and Application to Non-Spherical Stars10.1093/mnras/181.3.375 ↗
13. Smoothed Particle Hydrodynamics10.1146/annurev.aa.30.090192.002551 ↗
14. Müller, M., Charypar, D., and Gross, M. (2023, January 4–6). Particle-Based Fluid Simulation for Interactive Applications. Proceedings of the 2003 ACM SIGGRAPH/Eurographics Symposium on Computer Animation, Los Angeles, CA, USA.
15. Becker, M., and Teschner, M. (2007, January 2–4). Weakly Compressible SPH for Free Surface Flows. Proceedings of the 2007 ACM SIGGRAPH/Eurographics Symposium on Computer Animation, San Diego, CA, USA.
16. Adams, B., Pauly, M., Keiser, R., and Guibas, L.J. (2007, January 5–9). Adaptively Sampled Particle Fluids. Proceedings of the ACM SIGGRAPH 2007 Papers, San Diego, CA, USA.10.1145/1275808.1276437 ↗
17. Implicit Incompressible SPH10.1109/TVCG.2013.105 ↗
18. Hybrid SPH-FEM Solver for Metal Cutting Simulations on the GPU Including Thermal Contact Modeling10.1016/j.cirpj.2022.12.012 ↗
19. Xu, F., Wang, J., Yang, Y., Wang, L., Dai, Z., and Han, R. (2023). On Methodology and Application of Smoothed Particle Hydrodynamics in Fluid, Solid and Biomechanics. Acta Mech. Sin., 39.10.1007/s10409-023-23900-x ↗
20. Multi-Level Memory Structures for Simulating and Rendering Smoothed Particle Hydrodynamics10.1111/cgf.14090 ↗
21. Fast Octree Neighborhood Search for SPH Simulations
22. A Particle Packing Parallel Geometric Method Using GPU10.1007/s40571-020-00378-7 ↗
23. A survey on SPH methods in computer graphics10.1111/cgf.14508 ↗
24. Implicit Frictional Boundary Handling for SPH10.1109/TVCG.2020.3004245 ↗
25. Computer “Experiments” on Classical Fluids. I. Thermodynamical Properties of Lennard-Jones Molecules10.1103/PhysRev.159.98 ↗
26. Compressed Neighbour Lists for SPH10.1111/cgf.13890 ↗
27. Green, S. (2025, September 01). Particle Simulation Using CUDA. NVIDIA Whitepaper. Available online: https://developer.nvidia.com/gpugems/gpugems3/part-v-physics-simulation/chapter-30-real-time-simulation-and-rendering-3d-fluids.
28. PSCC: Parallel Self-Collision Culling with Spatial Hashing on GPUs10.1145/3203188 ↗
29. Optimized Refinement for Spatially Adaptive SPH10.1145/3363555 ↗
30. GPU-accelerated SPH fluids surface reconstruction using two-level spatial uniform grids10.1007/s00371-016-1289-x ↗
31. Generalized and efficient wall boundary condition treatment in GPU-accelerated smoothed particle hydrodynamics10.1016/j.cpc.2022.108507 ↗
32. Nishidate, Y., and Fujishiro, I. (2024). Efficient Particle-Based Fluid Surface Reconstruction Using Mesh Shaders and Bidirectional Two-Level Grids. Proc. ACM Comput. Graph. Interact. Tech., 7.10.1145/3651285 ↗
33. Zhang, W., Liao, X., Li, P., Jin, H., and Lin, L. (2017, January 23–27). ShareRender: Bypassing GPU virtualization to enable fine-grained resource sharing for cloud gaming. Proceedings of the 25th ACM International Conference on Multimedia, Mountain View, CA, USA.10.1145/3123266.3123306 ↗
34. Performance analysis of game engines on mobile and fixed devices10.1145/3115934 ↗
35. I-cloth: Incremental collision handling for GPU-based interactive cloth simulation10.1145/3272127.3275005 ↗
36. A new GPU implementation for lattice Boltzmann simulations on sparse geometries10.1016/j.cpc.2018.04.031 ↗
37. CPU-GPU parallel framework for real-time interactive cutting of adaptive octree-based deformable objects10.1111/cgf.13162 ↗
38. Jambunathan, R., and Levin, D.A. (2015, January 22–26). A hybrid CPU-GPU parallel octree direct simulation Monte Carlo approach. Proceedings of the AIAA Computational Fluid Dynamics Conference, Dallas, TX, USA.10.2514/6.2015-3057 ↗
39. Va, H., Choi, M.H., and Hong, M. (2021). Real-Time Cloth Simulation Using Compute Shader in Unity3D for AR/VR Contents. Appl. Sci., 11.10.3390/app11178255 ↗
40. Kim, T., Ma, J., and Hong, M. (2025). Real-Time Cloth Simulation in Extended Reality: Comparative Study Between Unity Cloth Model and Position-Based Dynamics Model with GPU. Appl. Sci., 15.10.3390/app15126611 ↗
41. Reinhardt, S., Huber, M., Eberhardt, B., and Weiskopf, D. (2017, January 28–30). Fully Asynchronous SPH Simulation. Proceedings of the ACM SIGGRAPH/Eurographics Symposium on Computer Animation, Los Angeles, CA, USA.10.1145/3099564.3099571 ↗
42. Constraint fluids10.1109/TVCG.2011.29 ↗
43. A GPU accelerated mixed-precision Smoothed Particle Hydrodynamics framework with cell-based relative coordinates10.1016/j.enganabound.2024.01.020 ↗
44. An evaluation of fast segmented sorting implementations on GPUs10.1016/j.parco.2021.102889 ↗
45. Ray Tracer based rendering solution for large scale fluid rendering10.1016/j.cag.2018.09.019 ↗