It is worth seeing this video of realtime simulated water flow. It isn't perfect, but it is very good, and what can you say but "wow" when you watch all that simulated water sloshing about!
There are two distinct approaches to creating any simulation in computer graphics.
You can take the accurate physics and try and implement it as accurately as possible.
You can attempt to find a process that matches the real physics closely enough so that they human eye can't really see the difference.
For example, you can attempt to render a 3D scene with highly accurate ray tracing that follows all of the laws of optics or you can adopt a simplified shading model such as Phong shading. It's not accurate but it usually looks good and it is a lot faster than accurate ray tracing.
When it comes to physics engines we have the same problem. Accurate dynamics or some fast approximation that is good enough.
Fluid flow is difficult, very difficult. A fluid is a physical entity that obeys an equation of fluid flow - usually the Navier-Stokes equation. This is a time-consuming equation to use in implementing a simulated fluid flow. It can be done and it is the approach the physicists and CGI special effects take in creating simulated water. The problem is that this takes a lot of computation and it makes a realtime approach impossible.
Of course, if you look really carefully at a fluid then eventually what you see is a set of particles moving under nothing more complicated than Newton's laws.
So why not just make a particle approximation?
The problem is that the particles in a fluid obey some constraints that are very difficult to model using the usual "particle with mass moving under a force" method. They have to move to keep the density and pressure in the liquid constant - the fluid has to be incompressible.
This is where the Position Based dynamics comes in. Instead of modeling the constraints by introducing suitable forces, you allow the particles to move as if they were free and then impose the constraints directly to correct the motion. This approach has been used on solid motion but now Miles Macklin and Matthias Muller at NVIDIA have applied it to fluid flow and the result is a fast and impressive simulation.
The results, using hundreds of thousands of particles, look a lot like water flowing and by "surfacing" the particles to make them look like a smooth flowing surface, the effect is even more impressive.
As you watch this video keep in mind that this is in real time running on a GPU in a standard PC.
Some of the simulations are shown as raw particles so you can see how they move. The "surfaced" simulations are where the particles vanish and the liquid looks a lot more like water.
So how good is it?
To most the water seems a little to viscous, but this is all the more impressive if you are going to use it in a game. There are one or two moments in the simulation where things don't appear quite right, but as far as most viewers are concerned it does seem to be good enough. Good enough for a game, perhaps, but of course this is not an accurate physics simulation and it isn't trying to be.
Perhaps even more impressive is when you put the fluid mechanics together with some fracture mechanics, i.e. in plain English when a fish tank breaks:
It is tough being a programmer - you have to put up with so much stuff from people who aren't programmers and even other programmers turn up and spoil your wonderful code. Is there enough that is posi [ ... ]