Real-Time-Gases
Gas simulation plugin for Unity based on the
position-based dynamic algorithm
Engine:   Unity
Languages:   C#, GLSL
Tools: Rider, Git
Project Link: GitHub
Project Description
With steadily increasing computing power real-time simulations of particle-based fluids gain more attention. For interactive applications the position-based dynamics are widely used because of their controllability. We present a GPU independent position-based approach for Unity, focusing on gases, with the capability to calculate the densities in closed environments. We show that a realistic gas simulation with reasonable performance, which calculates and visualizes the amount of gases in a game, can easily be integrated into Unity using this plugin. On a CPU with 3.30GHz, we have constant 40 to 50 frames per second using around 1k particles. A minimal simulation model can be acquired with four clicks, when the plugin is integrated.
Real-time Gases is developed as a particle-based simulation, that calculates the methods of the position-based dynamics on the GPU, while still providing a CPU version. To prevent permanent instantiation and destroying of particles, the maximum number of required gases is initialized in an object pool at the beginning of the simulation. Then all simulation values are sent to the GPU, where the needed calculations are run. After this, the resulting values are read from the GPU and applied to the simulation objects. In case of the CPU version, the position-based dynamic calculations are executed directly. At the end the particles positions are updated with their corresponding Game Objects.