Fluid simulations

A basic, basic fluid simulation demo in Blender

This post contains some notes on my beginning exploration of fluid simulations in Blender open-source 3D modelling and animation software.

As with a lot of things in Blender, fiddling around intuitively with controls doesn’t quickly converge on the desired result! This stems largely, but not entirely, from the incredible flexibility of the program. There are a lot of options.

Blender’s documentation is looking very good these days, and I recommend having a skim of the relevant page in the manual when trying something new. So if you’ve never done a fluid in Blender, you’d have a look at https://www.blender.org/manual/physics/fluid/introduction.html.

I’d actually suggest reading that instead of this page.

I’m writing this now anyway, because the point of view of a person discovering how to do something is very different from someone who has already learned, and that shift can happen quite fast. I’m trying to capture the points that I initially found elusive, before they look too trivial to write down. Perhaps this page will help someone click on one of the concepts. If not, at least writing it helps me to solidify my own understanding.

Overview

To end up with a picture or animation of a fluid, the essential steps are:

  1. Create the necessary objects for the simulation, and configure their properties
  2. Bake the fluid - that is, run the calculations of the motion of the fluid

I’ve also done some (inexpert) rendering to show the results of the fluid sim. Rendering is a huge topic on its own. You can check the baked simulation in the viewport before rendering, though.

1. Create objects

Various objects can be taken into account in calculating the motion of a fluid. At minimum, to run the simulation, we need two objects:

  1. The Domain object, which acts as a container for the simulation, and
  2. an object to define either the initial liquid shape, or the shape of a liquid source.

Other objects that can interact with the fluid (including collision objects) are covered in the manual under Fluid Types.

To include an object in the fluid sim, we go into the Physics tab (bouncing ball icon) and tick Fluid. Options then appear, beginning with the Fluid Type.

In my minimal example, I set up a rectangular prism as the fluid domain (designated as such by giving it Type Domain), and inside the domain, a low-resolution UV sphere as the starting liquid “ball” (Type Fluid).

Here’s the setup before running my simulation:

Left: Wireframe view of the fluid starting shape within the domain object; Right: Rendered view. The domain object is made of the material we want the fluid to have in the render. The material of the fluid object would often not even matter as you’d hide it after getting the simulation baked.

Left: Wireframe view of the fluid starting shape within the domain object; Right: Rendered view. The domain object is made of the material we want the fluid to have in the render. The material of the fluid object would often not even matter as you’d hide it after getting the simulation baked.

Notes on the domain object:

https://www.blender.org/manual/physics/fluid/types/domain.html

Notes on the fluid object:

https://www.blender.org/manual/physics/fluid/types/fluid_object.html

Fluid settings under the physics tab

In this case, for the Type, I chose Fluid, which means that my simulation will have a fixed amount of fluid in it, beginning with the shape and position of my UV sphere.

Baking

“Baking” is running the simulation itself. The options for baking are set in the Physics tab of the domain object.

All the “chunks” of the fluid (how many there are depends on the resolution you set for the domain object) need their positions and velocities calculated at each frame, and they all have to take their neighbours into account to some extent (I haven’t looked into the methods so I don’t know to what extent). This adds up to a lot of calculating, and can take some time and RAM to complete, even for a fairly simple scene.

Parameters in this demo:

Domain object Fluid Physics parameters:

Fluid:

Fluid World:

Fluid Boundary:

Fluid particles:

In the Render tab, the framerate was set to 12fps, so this results in 36 frames being calculated. I do have a suspicion that, depending upon other parameters, this may give an excessively large step size between calculations, which can lead to complications. It worked all right in this case.

Examples of different bake resolutions

Resolution 24 Resolution 100 Resolution 400
Frame 4
Res24_4 Res100_4 Res400_4
Frame 9
Res24_9 Res100_9 Res400_9

A GIF. Resolution 400.

Liquid Drop GIF made with Blender and GIMP

Other notes