Real-Time Fluid Dynamics for Games
Jos Stam
Alias | wavefront
210 King Street East
Toronto, Ontario, Canada M5A 1J7
Email: jstam@aw.sgi.com,
Url: http://www.dgp.toronto.edu/people/stam/reality/index.html.
Abstract
In this paper we present a simple and rapid implementation of a fluid dynamics solver for game
engines. Our tools can greatly enhance games by providing realistic fluid-like effects such as
swirling smoke past a moving character. The potential applications are endless. Our algorithms
are based on the physical equations of fluid flow, namely the Navier-Stokes equations. These
equations are notoriously hard to solve when strict physical accuracy is of prime importance.
Our solvers on the other hand are geared towards visual quality. Our emphasis is on stability
and speed, which means that our simulations can be advanced with arbitrary time steps. We
also demonstrate that our solvers are easy to code by providing a complete C code
implementation in this paper. Our algorithms run in real-time for reasonable grid sizes in both
two and three dimensions on standard PC hardware, as demonstrated during the presentation
of this paper at the conference.
Introduction
Fluid flows are everywhere: from rising smoke, clouds and mist to the flow of rivers and
oceans. Because one of the major goals of games is to immerse players into plausible virtual
worlds, it is desirable to include fluid flows into game engines. There already exist many ad-
hoc models that attempt to fake fluid-like effects, such as particles rendered as textured
sprites. However, animating them in a convincing manner is not easy.
We believe that a better alternative is to use the physics of fluid flows which have been
developed since the time of Euler, Navier and Stokes (from the 1750’s to the 1850’s). These
developments have led to the so-called Navier-Stokes Equations, a precise mathematical
model for most fluid flows occurring in Nature. These equations, however, only admit analytical
solutions in very simple cases. No progress was therefore made until the 1950’s when
researchers started to use computers and develop numerical algorithms to solve the
equations. In general, these algorithms strive for accuracy and are fairly complex and time
consuming. This is because the applications that require these solvers have to be physically
accurate. It is obviously crucial that the stresses and drag on an airplane or a bridge are
calculated precisely.
In computer graphics and in games on the other hand what matters most is that the
simulations both look convincing and are fast. In addition it is important that the solvers aren’t