In order to have a useful fluid simulator, the fluid has to be in some kind of container or environment, and the fluid needs to interact with this environment. For that purpose, I added support in my little experimental fluid simulator to be able to load an arbitrary polygonal surface and have the individual particles interact with the surface in order to contain the water or redirect the flow.

Here is a first test of this I got running yesterday using a simple stream bed model our modelers whipped up at work. I added a particle emitter to rapidly fill up the basin at the top of the stream bed in about 4 seconds, and then turn it off so I can watch the flow scale back as the water flows out without being replaced at the top. I might need to do a longer test later, because the water took longer to flow out than I expected.

As before, this render is a very simple OpenGL render of the particle system, and YouTube’s compression can make it a little difficult to see it clearly.

But all in all, I was pleasantly surprised by the results. There is still some more tweaking to do with the interaction between the particles and the surface. (In close-ups, the particles bounce off the the surface of the rock like oil on a hot pan.) But this should just be a matter of reducing the repulsion force. I also have some ideas about how to change the way forces are propagated between particles that will numerically stabilize the simulator at larger time steps that should both speed up the simulation by an order of magnitude as well as solve some of these “bouncy” artifacts. (This render of about 0.5 million particles took a few hours on my laptop for 17 seconds of dynamics.) Not sure when I will get to this, though.

The next step will be to try to export the particles to Maya or Houdini to do a more photo real render with properly surfaced stone and with refraction and reflection of the water as well as motion blur enabled.

I’ll try to post that when we get something to see.