For the past couple of weeks I’ve been working on some quite significant changes to particle fluids. Raul and Stephen did a great job in getting the whole fluid system functional and integrated code wise, but after testing the whole system for quite some time I came to the conclusion that the available parameters are not really as artist friendly as I’d like them to be.

The current fluid panel

First of all the interaction radius is a very important value for the fluid algorithm, but it’s not very intuitive to the user. There’s no visual feedback on how big the radius is and even if there was there’s no way of knowing what a good radius is. A second very important parameter is the rest density, but this doesn’t correspond to an actual density as it’s just a semi-physical parameter exposed straight from the algorithm. As with the interaction radius there’s no way for a user to know what a “good” rest density is.

In the new version the interaction radius and rest density are both calculated from the particle size. The advantage in this is that the particle size can be visualized (draw size from the particle display panel) and the size can just be adjusted until the initial fluid distribution is “continuous” so that basically the neighbouring particles are touching. As both the interaction radius and rest density are now controlled with a single and intuitive value a proper size for the particles can usually be found for pretty much any type of simulation scenario in just couple of tries. The particle mass also plays a very important part in how the fluid behaves, but now as particle size effects the simulation a pretty good initial value for the mass can be achieved by simply checking multiply mass with size.

What I've been working on

The new basic controls have been further simplified to only include the parameters stiffness (how incompressible the fluid is), viscosity (smooths the fluid motion) and buoyancy (less dense fluid rises up). These three are quite intuitive parameters and can easily be adjusted towards wanted behaviour based on test simulations. For example “fluid doesn’t hold it’s volume” -> increase stiffness, “fluid doesn’t flow nicely” -> increase viscosity. It’s now also easier to determine the need for subframes, since the more stiff and the less viscous the fluid is, the more subframes you’ll probably need for stable simulation. There are also separate advanced parameters to those who want to tweak just some specific aspect of the simulation, but in most cases these can all be left to their default values.

In addition to these changes I’ve modified the fluid algorithm a bit so that most of it is now thread safe. Once particle dynamics become threaded in general this should provide a nice speed boost for fluid particles as well.

I’m still not quite finished with this and before I am I’d like to get some feedback from all of you who have used the fluid particles. Do these new parameters and the described work flow seem more intuitive? Have I possibly forgotten something?

P.S. I must apologize in advance, since I know for certain these changes will effect existing simulations quite a bit as most of the parameters will change their meaning, but hopefully new suitable parameters can be found quite easily now that hopefully the parameters actually make sense.