We present a unified GPU-accelerated framework for real-time Smoothed Particle Hydrodynamics (SPH) fluid simulation with two-way rigid body coupling, secondary particle effects, and volumetric rendering, implemented entirely within the Unity game engine. The framework employs a weakly compressible SPH formulation with O(n) count sort-based spatial hashing and introduces a signed distance field (SDF) coupling system that evaluates three representative geometric primitives, sphere, cylinder, and torus, of increasing topological complexity directly on the GPU. Bidirectional force exchange is achieved through lock-free atomic compare-and-swap impulse accumulation, enabling thousands of fluid particles to interact simultaneously with each rigid body without serialization. A GPU stream compaction–based secondary particle system generates and classifies foam, spray, and bubble effects in real time, while a volumetric rendering pipeline samples fluid density into a 3D texture for SDF-composited volume rendering without surface mesh extraction. A conditional kernel dispatch strategy eliminates GPU cycles for disabled subsystems, and dynamic buffer management reduces memory pressure through runtime allocation. The system sustains above 54 frames per second at four million particles on a consumer-grade GPU, with sub-linear frame time scaling and a 1.70× speedup from dynamic buffer allocation over static pre-allocation.
Waseem et al. (Tue,) studied this question.