7.6 – Physical Dynamics – Volumetric Systems: Fluids

Inside a cubic domain divided into a discrete number of voxels, Blender is able to simulate the complex behavior of fluids. This kind of simulation is rather computationally intensive and often consumes a significant amount of memory, especially if you want to achieve an accurate and realistic result. Therefore, we will start by studying relatively light examples, and then increase the quality of the simulation based on both the hardware we have and the scene we want to create. Let’s start with a cube to which we assign the physics Fluid > Domain

As you can see, this time we have set Liquid in Domain Type, while for the first tests you can set Resolution Divisions to 32. Increasing the volumetric resolution increases the cubic number of elementary voxel units to be processed. If we are using a computer with a multicore CPU of the latest generation, a 64-bit operating system and a lot of ram (like most computers currently on the market), we can still obtain fairly detailed simulations with sustainable processing times. On a dual-core computer with just 4 gigabytes, it is advisable to experiment with these parameters, or slightly higher, to avoid software blocking. Unlike gaseous systems, the domain will not be automatically represented in wire frame (we will see why later). In addition, in the Border Collisions field, all entries are selected by default (so that the fluid cannot leave the domain). We go to the wire frame visualization of the 3D View and within the domain (the usual cube) we insert a UV Sphere to which we will assign the dynamics: Fluid > Flow

This time in the Flow Behavior field we choose Geometry because we do not want the surface to emit the liquid, as the goal is to transform the volume of the sphere into liquid.

Starting the animation and through the wire frame visualization of the 3D View, we will see a Particle System in action that, starting from the initial shape of the sphere, will impact the bottom of the domain according to the setting of gravity acceleration in the scene context; the fluid will then expand to the edges of the domain and return to the level of the gravitational potential.

From this first experiment, it is possible to notice how realistic the motion of the fluid is, despite its still rather rough graphical representation. If we go to the Particle Properties context (of the Domain), we will find the Liquid particle system.

We can render this system as seen in paragraph 7.3, or follow another path: go back to the fluid dynamics options for the domain and increase the resolution to 64. For the next examples we will choose the Modular processing with a check mark on Is Resumable in the Cache panel.

After processing, we activate the mesh panel (options related to the domain) and leave the default settings, then simply click on Bake Mesh.

You will see that the mesh of the cube domain will be divided and adapted to coincide with the shape and motion of the particle system (to see the mesh alone, you will have to disable the visibility of the particle system in its context).

This will greatly simplify our lives because we will simply have to define the material for the cube and proceed to rendering. In fact, the usual principled shader will be enough, setting the transmission value to the maximum and adjusting the IOR (after choosing the base color).

Inside the domain, we can make the fluid interact with any mesh.

Let’s proceed with the creation of a semi-spherical container (UV Sphere with half of the vertices deleted in edit mode) and Fluid > Effector dynamics with these settings:

As you can see, I have set Collision in Effector Type, checked the Is Planar box (useful for meshes like this one that do not have an internal volume). It is possible to increase Surface Thickness and Sampling Substeps to make the fluid detect the presence of an obstacle in time without passing through it. The fluid is still generated from the volume of a UV Sphere (smaller).

Finally, the effector mesh can be made invisible and replaced by an identical one without any type of physical dynamics, whose function will be purely representative, perhaps with a thickness (solidify modifier).

Now let’s see another interesting example of interaction between fluid and mesh effector>collison, with a small sphere with a rigid body dynamics that, when falling, will impact the fluid inside the domain.

In the front ortho view we see the cube domain (outer square) and the fluid (inner rectangle and placed at the bottom of the domain); higher up is the UV Sphere with both rigid body physics and fluid effector (collision).

As a rigid body, the sphere, due to the action of gravity, impacts the fluid, continuing beyond the bottom of the domain with which it will not interact. From the wire frame images (front ortho view) below, you can clearly see the volumetric discretization of the fluid.


We conclude this first introduction to fluid physics by observing the remaining panels of the Fluid dynamics of Domain type. In the Diffusion panel, we can set the viscosity of the fluid by choosing from 3 basic presets: Water, Honey and Oil.

In the Particles panel, the creation of three different types of fluid particles is adjusted:

  • Spray, splashes and drops that occur in impacts.
  • Foam, floating particles on the surface like foam.
  • Bubbles, air bubbles.

Once the three boxes are activated, you just need to click on Bake Particles. At that point, the new systems will appear in the Particle context.

In the previous images, from top to bottom, we see the Spray, Foam and Bubble particle systems, respectively. These are to be rendered with the methods seen in paragraph 7.3. For splashes, for example, you can define an icosphere with the minimum number of subdivisions, assign the liquid shader to it and render the particle system using this mesh as an instance object.

Inside the domain, we can make fluid continuously generated or subtracted, using meshes with Fluid Inflow and Outflow physics. We insert a smaller cube inside the Cube Domain, as in the image below, to which we will assign Fluid>Flow>Inflow physics.

In the Initial Velocity panel, we will set the inflow speed on the X axis (global reference). In this case, the fluid will be generated from the volume of the mesh; if it had been flat and without internal volume, we would have had to activate the Is Planar box.

When the inflow cube is completely covered, it will not generate any more fluid, but will maintain a convective push on the existing liquid.

By inserting a mesh with fluid outflow physics (for example, at the bottom of the previous scene), it will absorb all the particles inside its volume, making it impossible for the fluid generated by the inflow cube (at the top) to exceed a certain level.

Let’s try to calculate and observe the motion of the particles: Spray, Foam and Bubble, also for the system just analyzed. In the following images, from top to bottom, you can see the three individual particle systems (the Fluid system has been converted to mesh) in action in the orthographic view, and then all together. I remind you that the colors from blue to green, and from green to red indicate the increasing speed of the particles, which is understandable by observing the animation in motion.

The physical systems analyzed in these last two paragraphs respond to the influence of the forces studied in paragraph 7.3. Let’s see, for example, the effect of a Vortex force on liquid initially at rest. Again, I have transformed the fluid particle system into a mesh and then processed the usual particle systems: spray, foam, and bubbles, visible simultaneously in the images.

Next paragraph
Previous paragraph
Back to Index

Wishing you an enjoyable and productive study with Blender, I would like to remind you that you can support this project in two ways: by making a small donation through PayPal or by purchasing the professionally formatted and optimized for tablet viewing PDF version on Lulu.com  

>Purchase the ebook (PDF) on Lulu.com securely using PayPal and prepaid cards<