In this Intel-sponsored feature, part of Gamasutra's Visual Computing section
, Intel engineer Quentin Froemke describes a multi-threaded fluid simulation system created to make virtual smoke or water for use in games, including an executable demo and source files.
As Froemke explains in the introduction to the technical feature, which is now available on Gamasutra
and is part of a series of Intel-authored technical pieces being posted on the site:
"Along with mentioning a strange rash, a sure way to kill a conversation is to bring up the topic of Computational Fluid Dynamics (CFD). But for those who wish to create fantastic-looking clouds, explosions, smoke, and other game effects, nothing could be more exciting!
CFD is the section of fluid mechanics that finds numerical solutions to the equations describing the behavior of fluids, both liquid and gaseous, and their interaction with various forces. Until recent hardware advances, even approximating a solution was too computationally intense for real-time applications.
However, the last year or two has shown a small but increasing amount of research and articles, as well as the release of some commercial products that deal with simulating fluids, not only in real time but in a video game environment.
With the Kaboom project, we've created a modular, threaded CFD simulation that can be dropped into an existing project, hooked up to a rendering engine, and used to generate realistic, real-time fluid dynamics simulations, suitable for smoke or water.
We observed that many games are not reaching their full potential because they're unable to use all of the available CPU resources. Frequently, this is because they are not properly threaded for multi-core architectures.
Rather than run the simulation on the GPU, we decided to use those extra cycles to produce a basic, real-time fluid simulation. By performing the simulation on the CPU as opposed to the GPU, the simulation has fast and easy access to all game resources (such as mesh information) and the game has access to the simulation results. This also leaves the GPU free to handle the graphics."
The full Gamasutra sponsored feature on the subject
goes into much more depth on the technical setup needed to accomplish such a system, with specific source code included.