New GPU Water Simulation at SIGGRAPH 2013
While the SIGGRAPH graphics conference will happen only in July, we already have the preview of one of the presentations. Miles Macklin and Matthias Müller from Nvidia have developed a new real-time approach to simulate the volumetric liquids on GPUs. Abstract of their submission paper states:
"In fluid simulation, enforcing incompressibility is crucial for realism; it is also computationally expensive. Recent work has improved efficiency, but still requires time-steps that are impractical for real-time applications. In this work we present an iterative density solver integrated into the Position Based Dynamics framework (PBD). By formulating and solving a set of positional constraints that enforce constant density, our method allows similar incompressibility and convergence to modern smoothed particle hydrodynamic (SPH) solvers, but inherits the stability of the geometric, position based dynamics method, allowing large time steps suitable for real-time applications. We incorporate an artificial pressure term that improves particle distribution, creates surface tension, and lowers the neighborhood requirements of traditional SPH. Finally, we address the issue of energy loss by applying vorticity confinement as a velocity post process."
This sound quite complicated, but here the simplified idea. There exists an old and powerful approach to calculate behaviour of volumetric fluid composed of many particles – SPH. It can be very accurate when configured in a right way, but that also means a requirement for small time steps and a lot of computational power. It is not something you can run in real time on current home PCs while getting a correct behaviour. Using lower precision in such complex simulation doesn't just give fewer effects, but often leads do behaviour that is much worse than simpler solutions. The authors try to use a different method – Position Based Dynamics, which is a method for general particle simulation that gave good results in cloth simulation. They modified it with some additions to get a better correspondence with the behaviour of the liquids while still being able to run in real-time on modern GPUs. It isn't as precise as SPH can be, but gives better results when running in real-time on current hardware.
The computational requirements of such water simulation are still quite high. Bathing a bunny required 128 thousand particles for water and 256 thousand for foam and sprays to get a more realistic look, which ran at 30 FPS on GTX 680. It will take more than several generations of GPUs before this method becomes feasible to use in games for larger areas. Some games have already tried to add volumetric water, but lower precision leads to water behaving more like jelly would. It will be interesting to see if new developments in the future will bring us even closer to having realistically simulated liquids in our games.