SuperFluids v1

Up to 1 million 3D particles being simulated in real-time using a SPH ( smooth particle hydrodynamics ) using DirectX 11 computer shaders on a NVidia GTX 780 TI.

 

Download the demo here. Requirements: Windows 7/8 and GPU capable of DirectX 11.0 and as precautionary measure, some snorkeling gear.

 

This demo was based on the FluidCS11 sample by Microsoft which was based on some work from Matthias Müller and Scott Le Grand. I overhauled it for the following reasons.

This simulation enforces a minimum of 180 steps per second and a maximum of 300 steps per second. Anything under 180 steps will make the simulation unstable, and anything over 300 is overkill and waste GPU cycles. The render rate is set to 90 frames / second and is throttled independantly from the simulation speed.

 

If you set the simulation to use 512k particles, a GTX 780 TI will be able to render the final particles at 90 fps, but will only be able to simulate them at rougly 50% of the target simulation rate. If this happens, it will simply appear that time has slowed down and the water will continute to simulate properly. Check the "Simulation Speed ( Actual )" to see if it is running at full speed.

 

This simulation uses an orthogonal view, but the SPH algorithms are in fact running in 3D using a dynamic grid cell approach for sorting and spacial search. It divides the grid based on where the action is. The dimensions of the box is 4x2x1 ( width, height, depth ) and if you use 512k or 1024k particles they splatter at first because they initialize outside the walls and get blown inward with massive force ( need to fix that ). If the wall restraints are disabled, the water can flow whereever. The simulation uses 20+ compute passes for grid-based particle sorting and another 10+ passes for the simulation and rendering.

 

Version 2.0

 

Click here for videos ( and eventually a download ) of version 2 of SuperFluids which exposes a bunch of options, mutli material support, more parameters to mimic a wide range of materials like milk, blood, syrup, goo, snow, sand, cotton, foam, whip cream etc.