Gamasutra: The Art & Business of Making Gamesspacer
Sponsored Feature: Fluid Simulation for Video Games (Part 1)
View All     RSS
October 22, 2014
arrowPress Releases
October 22, 2014
PR Newswire
View All





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
Sponsored Feature: Fluid Simulation for Video Games (Part 1)

October 15, 2009 Article Start Page 1 of 5 Next
 

[This sponsored feature, part of Intel's Visual Computing site and written by Dr. Michael J. Gourlay of the University of Central Florida Interactive Entertainment Academy, begins a multi-part series that explains fluid dynamics and its simulation techniques.]  

Introduction to Fluid Dynamics

Video games appeal to our desire to explore and interact with our environment, and adding real-world phenomena-such as fluid motion-allows game developers to create immersive and fun virtual worlds. Recently, physical simulations have become more realistic, but the simulations have largely been limited to rigid bodies.

Pervasive simulations of continuous media like cloth and fluids remain uncommon, largely because fluid dynamics entail conceptual and computational challenges that make simulating fluids difficult. This article begins a three-part series that explains fluid dynamics and its simulation techniques. The article culminates in an example of a fluid simulation algorithm suitable for use in a video game.

To get started in fluid simulations, you need to understand the fundamentals of fluid dynamics. Let's start by covering some of the basics.

What Is a Fluid?

A fluid is any substance that flows (in other words, a substance that can take the shape of its container) and does not resist deformation (meaning that it slides when dragged). People often use fluid and liquid interchangeable, but technically, the term fluid can refer to either a liquid or a gas. A gas fills its container completely, whereas a liquid has a distinct "free surface" whose shape does not depend on its container. (Often, when you use computer graphics to visualize a liquid, you render only its surface-for example, ripples on a pond or a stream of water.) The distinction between liquids and gasses can influence how you model the fluid, but both obey the same basic fluid formulae and share similar properties.

But what about smoke? Smoke seems to behave like a gas but also appears to have a kind of surface, although perhaps not as distinct as that of a liquid. The answer is that smoke is really a combination of a gas and tiny suspended particulates, and the combination of these particulates is called an aerosol. Those particulates follow the motion of the gas (and let game players see that motion) without necessarily influencing the motion. You can usually treat smoke as a kind of gas, where one of its properties-for example, density or composition-varies.

Varieties of Physical Simulation

Whereas fluid dynamics might not be as familiar to most video game programmers, some forms of physical simulation have become commonplace. For the sake of context, let's see where fluid simulations fit into the spectrum of physical phenomena:

Particles are points that have position, mass, and velocity but (in principle) no size or shape, as Figure 1(a) shows. The relationship between forces and motion is linear. Particles are easy to simulate but rather uninteresting.

Rigid bodies have shape and orientation in addition to position, mass, and velocity-for example, blocks and balls. If you add the notion of "shape" to a particle, you get a rigid body, as Figure 1(b) shows. Rigid bodies are still easy to simulate: Most of the difficulty comes from detecting and responding to collisions. Stacks of bodies are usually the most difficult to solve, because everything in the stack continuously collides with everything else in the stack-even if nothing moves.

Articulated bodies, shown in Figure 1(c), are connected networks of rigid bodies-for example, character models. These bodies behave identically to rigid bodies that are continuously involved in a form of collision where the points of contact have a limited variety of ways in which they can move (called constraints).


Figure 1. Simple physical phenomena: (a) particles, (b) rigid bodies, and (c) articulated bodies

Deformable bodies can change shape but retain their connectedness and adjacency of various points on the body. Think of this as a model where the edges between vertices never change which vertices they connect, but the locations of the vertices can move. Their type depends on their dimensionality:

  • 1D. Thread, string, rope, chain, hair, and so on, shown in Figure2(a)
  • 2D. Cloth, as shown in Figure2(b)
  • 3D. Soft bodies, like the jiggly bits of a character model, as shown in Figure2(c)


Figure 2. Deformable bodies: (a) thread, (b) cloth and (c) soft bodies.

Fluids have lots of freedom of motion. The motion is nonlinear (more on that later), and their shape and topology can change, as shown in Figure 3. Fluids require specialized simulation techniques: Because fluids take the shape of their container, they are always in collision with everything around them, including the fluid itself. So a collision with one part of the fluid effectively means that the whole body of fluid must respond.


Figure 3. Fluids: (a) liquid and (b) smoke.


Article Start Page 1 of 5 Next

Related Jobs

Avalanche Studios
Avalanche Studios — New York, New York, United States
[10.22.14]

UI Programmer
Avalanche Studios
Avalanche Studios — New York, New York, United States
[10.22.14]

UI Artist/Designer
Wargaming.net
Wargaming.net — Hunt Valley, Maryland, United States
[10.22.14]

Lead UI Engineer
Wargaming.net
Wargaming.net — Chicago, Illinois, United States
[10.22.14]

Lead UI Engineer






Comments


Andrew Hopper
profile image
Loved this article because I believe that (with some re-evaluation, experimentation, and tweaking) fluid mechanics can also be used to create some interesting movement patterns for any kind of swarm-based systems, like legions of zombies or a hive of killer attack bees. By examining how swarms of free-flowing particles interact with each other on a natural level, we can better understand how to create more natural movement for larger scale swarms.

Berk Atabek
profile image
very nice intro :)

Bo Banducci
profile image
The first line...



"Video games appeal to our desire to explore and interact with our environment."



Do we really have such a desire? Look around...

Michael Gourlay
profile image
I just wanted to mention that despite what the text in the second paragraph of this version of the article indicates, the series has more than three parts. So far, 5 have been written and 2 more are planned. Inteil has simply only by now published the first three.



(Originally it was planned to have 3 parts, but it grew as we realized better ways to organize the topics, and that we could use the subject to explore related avenues.)

Arshad Hussain
profile image
A very helpful article to the programmer interested in soft body/fluid programming.

Thanks a lot!!


none
 
Comment: