Simulating fluids in computer graphics
Liquid substances are as common as rigid bodies. Unlike rigid bodies, they usually don't sit in one place and not do anything. They reflect and bend light, create waves, flow, move in a strange way and generally make the life of the programmer who tries to simulate them as miserable as possible. Also, to make things worse, the human eye can forgive discrepancies in rigid bodies but not in fluids. Therefore, representing fluids accurately is vital for a realistic picture in computer games as well as in many other computer graphics simulations. Luckily there are a lot of techniques in simulating fluid dynamics and representing fluids, which almost makes it a separate field in computer graphics (I'm sure there could be a whole semester dedicated to fluids in computer graphics).
There is a lot of work done in scientific computation of fluid dynamics. Even though it's a difficult topic there are lots of mathematical models that represent fluid dynamics very accurately. The only problem is that usually it takes a lot of computation power and it can take hours to render one scene. Computer graphics have a different goal in simulating fluid dynamics when compared to the simulation of fluid dynamics in science. We don't much care about accuracy as long as it looks good, runs fast, and it's fairly easy to code. Therefore, even though computer graphics fluid simulation has its roots in scientific fluid simulation, the techniques that we use are quite different. Very often those techniques are dictated by the specific needs of the simulation and hardware that we are planning to implement it on (CPU or GPU.)
example can be simulating a large body of water like a river or lake.
In real life we don't see what is going on at the bottom, we see only
the top layer, so why calculate the fluid dynamics for entire body
when we can calculate only the top layer while taking into account
the processes that go on in the depths and might affect the top
layer. One way to do this was mentioned in “Efficient
Simulation of Large Bodies of Water by Coupling Two and Three
Dimensional Techniques ”. The authors of this paper propose
to represent most of the body of water by tall cells which are
assumed to have linear pressure profiles. The top layer and the layer
around an object is simulated using a three-dimensional Navier-Stokes
free surface solver (the idea and the mathematical equation is
similar to that which we discussed in class.) The tall cells allow
the program to keep track of underwater terrain while keeping the
fluid simulation in the run-time range. Image 1 shows schematics
simulating a ball dropped in a body of water. Only the top level and
the water around the ball are simulated with the Navier-Stokes
Here is the same scene rendered in several different ways:
Three balls splashing into water (300 × 200 horizontal resolution). The fully refined case (left) and the 1/4 refined case (middle) are quite similar. However, quite different results are obtained if one doesn’t refine enough (right, 1/16 refined).
Below the same technique is used to simulate a river flowing through a pass and a boat moving through a body of water.
The other approach, which is also entirely different from the first example, was mentioned in “Fluid Animation with Dynamic Meshes”. This paper introduces a method of animating fluids using unstructured tetrahedral meshes that change at each time step. The method is particularly good at simulating the interaction between rigid bodies and fluids. The authors of the paper use a staggered fluid state storage scheme that stores pressures at tetrahedron circumcenters and “face-normal velocities,” the component of velocity in the direction of the face normal, at the face circumcenters. This staggered method is used to discretize the inviscid Euler equations:
In these equations, u is the fluid velocity, t time, p pressure, ρ density, and f any external forces. The next image illustrates the use of this method:
A paddle mixes smoke in a tank. Bottom: A cross-section of the
simulation meshes used for each frame.
In conclusion, in the simulation of fluids there are three things that are important: visual plausibility, efficiency, and complexity. It's as important to be accurate as it is to have a realistic effect. Also, most of the time it is important to render images on run-time. It is equally important to have a technique that is easy to implement, because most likely water is not all that you need to simulate in your application. Therefore, it is important to chose the appropriate technique for one's particular need.
Some reference material that I was able to find so far:
Ron Fedkew has large collection of short videos of various simulations including fluid simulations. At the bottom of the page there are links to some good papers about simulating water and other fluids.
The next one is a link to the paper that discusses a simulation of fluid flowing through a porous deformable material.
The next one is a paper on fluid animation with dynamic meshes. It discusses a method for animating fluid with unstructured tetrahedral meshes that change at each time step.
Frank Petterson has links to several papers about fluid simulation.
Ives Macedo's Paper on simulation of fluids for computer graphics.