Water simulation in a moving, rotating and deforming container

I player around with fluid simulation before, and managed to get realistic water inside a static box aquarium. But now I’d like to take the idea further: I wish to have water in a moving, rotating and deforming container.

Consider you’re holding a transparent plastic coke bottle, half filled with water. As you rotate it, the water always stays at the bottom. Now imagine you are crushing it, or (although impossible IRL) stretching its sides and expanding it. Even better, think of a soft plastic bag filled with water and your fingers deforming it.

The deformation of the bottle would probably be done using animated shape keys, while location and rotation by changing object position. Question is, can fluid simulation keep up with detailed mesh deformation plus movement and rotation of the object? I tend to be unsure it will simply work, so maybe there’s a workaround or special way to achieve this?

The deformation of the bottle would probably be done using animated shape keys, while location and rotation by changing object position. Question is, can fluid simulation keep up with detailed mesh deformation plus movement and rotation of the object? I tend to be unsure it will simply work, so maybe there’s a workaround or special way to achieve this?
Animated shape keys can be used to deform a contained that contains a fluid. I suggest you give a go and experiment

No other way to expand or squish a container and have the fluid update? What if the container is deformed by an armature for instance? If no workaround exists, I’ll prolly have to think of other ways to do water in this circumstance… although it’s unusual for Blender to miss any type or idea of simulation.

Experimented a bit yesterday. I didn’t get to the “moving and rotating” part yet, though I assume there are ways to get that working too. Instead I tried to make a crushing container.

As I just found out, the fluid Domain may only be a cube, so instead I focused on doing this on the Obstacle mesh. I made a low-poly inside-out sphere, set that to Obstacle, and added a fluid inflow to fill it during the first frames. The sphere contains a shape key which crushes part of the surface. A few frames later after the water surface calms down, I slowly set that shape to 1.

Unfortunately that doesn’t seem to work. If I set the sphere’s slip to Partial or Full Slip, the shape key is completely ignored. If I set it to No Slip (which is said to work for moving objects) the shape key is treated as if it was enabled from the beginning, instead of deforming the fluid during the frames when it’s being turned on.

Someone on the Blender IRC said it should be possible to make fluids notice shape key changes in obstacles. Is this true? If not, are there other alternatives?

If your fluid resolution is too low, or your obstacle is too thin, the effect of the shape key won’t be visible on the final fluid behavior because it will be swamped by all the inaccuracies in the simulation.

You need to add a Control object to the domain. The Domain can only be a cube, but the control object can be any mesh shape.

http://wiki.blender.org/index.php/Doc:2.6/Manual/Physics/Fluid/Control