Particle fluids refactoring under way

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.

13 comments
  1. Using particle size seems to me very intuitive and clever. I like that.

    “Stiffness” and “viscosity” I always felt like were close to the same thing. What’s a fluid that’s very stiff but has no viscosity? How about a fluid that’s not stiff but has lots of viscosity. It’s hard for me to imagine. Instead I wished to see parameters like

    viscosity : how much force has to be applied for two particles to tear apart
    Maybe that’s what you already did. That’s my understanding of viscosity though, in my own words. Very viscous fluids are like putty, and they stretch out.

    surface tension : unlikelihood that two particles will stick together.
    water has a little bit –everyone knows that. But it’s easy to understand that silly putty would also have a medium to high surface tension with some randomness. That way if two pieces are thrown together they might bounce off each other completely, or a few bits might bond, but the rest would bounce and the force of the two bodies moving away from each other again would tear those little strings apart.

    elasticity : the amount that the shape will want to return to its previous form.
    maybe this is what you’re calling stiffness? If so, then either name works.

    mass: the mass of one cubed unit of that fluid.
    This seems obvious and doesn’t need a lot of tweaking. From mass, bouyancy should just be derived. One of the issues I had with fluids in the past was defining “air” particles. Looking at this panel I’d say “What’s the bouyancy of air? Um.. infinite? a thousand? nine point eight?” Thinking about mass is way easier. “Air. zero. water… i’ll wikipedia it. There. Molar mass is 18.015” Doing that process really *should* get me very close to water and air.

    Those are the four parameters I most often think about when I want to do a fluid simulation. Then, when I look at the panels, it’s like reading spanish, and checking my spanish-to-english dictionary. “Hmm… Viscoelastic Springs… I should look that up…” or “Repulsion factor sounds simple enough, but it’s under a section called advanced… maybe i shouldn’t mess with it” or whatever.

    I really appreciate that you’re going through the effort to think about how people will interact with this panel. interaction design is a lovely practice, and more people should take it on. I’m only being so gabby because i’m interested in building a good experience too! :) I think the best people you could ask next — outside of blender — are students in physics classes. The basics of understanding when you talk to someone that has common knowledge about fluids or maybe a little bit of physics learning (but doesn’t have experience with fluid dynamics) might be the perfect people to talk to. That way, Blender will feel good enough to use in a classroom for demonstrations, or as a good learning aid to someone trying to understand fluids in general — not just in blender. That would help us all become a little more sane.

  2. Hey there, any estimation when this will be commited?

  3. +1 from me

    The new system looks more intuitive for sure. Right now, I would have to preview-bake any particle sim at the full particle count, since changing the amount of particles changes the entire behavior of the sim. With this update, does changing the particle count alter the interaction radius in a way that the behavior of the fluid stays more or less constant?

  4. Thank you all for the positive comments!

    ZEAURO: Yes mixing different fluids will be still possible just like before.

    NIEGHEL: Surfacing is being currently worked on by Raul and Stephen, so I hope we’ll be seeing some nice progress on this front soon!

    LE@NDRO: Tsk! Particles 0 – Dictionary 1! :)

  5. I guess that ‘rest density factor’ still let us adjust rest density and interaction radius separately if needed. All ok then.

    It do look more logical this way.

  6. I gues that ‘rest density factor’ still let us adjust rest density and interaction radius separately if needed. All ok then.

    It do look more logical this way.

  7. Hi! I find your changes much more intuitive! Separating Basic and advanced parameters gives it a more organized way to start tweaking. Right now my “pipeline” was just touching everything while looking the simulation in real-time (Blender 2.5x is awesome!).

    Only one thing: buoancy => buoyancy? (I could be wrong, I’m no physicist!)

    Thanks for the hard work! It’s really appreciated!!!

  8. This is very good, but without surface generation, is unusable too. When are you planning to integrate it in the pipeline?

  9. when will we see surface generation for the fluids particles?

  10. It seems to be really more intuitive.
    I already use particle size and interaction radius a lot to adjust simulation between a preview with a weak amount and a long time baked simulation with a heavy amount of particles.
    So, it seems to be a good change for one fluid simulation.

    But what about interactions of multiple fluids simulation ?
    Is it still easy to animate mixing of fluids ?

  11. I’ve been having similar issues and I’ve been experimenting with fluid particles a lot. I tried to solve or fix some of the problems that I came up with by studying carefully the documentation of the SPH System from farsthary. But e.g. the breaking dam scenario is really hard to get right when you change just the size of the particles input grid (or the mesh acting as domain for the grid).
    So reading your explanation of ‘coupling’ certain parameters seems to make a lot of sense in an artist friendlier way. Those basic, simple starting setups like input mesh size filled with particles keeps its volume once interacting with collision or other particles is most essential I think. I found these parameters really, really hard to get right and frustrating. So it seems to be a very good way to redefine and make thos base animations much simplier and tweaking faster without breaking it all again once you have a good starting point.
    One think I could think of (but that’s just a personal timesaver) would be a few very simple presets like ‘gas like fluids’, gooey fluids and water like fluids in small or large scales. Just to have starting points.

  12. I’d be really interested in see the new changes. I spent a number of days just experimenting with the fluid particles in the newest builds. I love the functionality, but the controls are really confusing. But I’m also not an “expert user”.

    I think using the size of the particle in place of interaction radius and rest density makes so much more sense. I was really struggling with those, even after reading Raul’s website posts on his tests of each setting.

    Really interesting stuff and look forward to what you come up with!

In order to prevent spam, comments are closed 15 days after the post is published.
Feel free to continue the conversation on the forums.