An Introduction to Mantaflow
Over the past two years, Blender has grown in popularity by an extraordinary margin. With the introduction of version 2.8 came a whole lot of new users wanting to learn what this free open source program is all about. More users are coming in every day and in 2020, Blender was downloaded over 14 million times!
This software includes the entire 3D workflow and there are so many things you can create using it. Not only is Blender used for creating 3D models but it can also be used for texturing, animation, rigging, compositing, motion tracking, game design, video editing, and, of course, the topic of this book, simulating! We will be covering all the simulations that Blender has to offer, starting with the fluid and smoke simulations.
Creating a fluid or smoke simulation in Blender is complicated and sometimes quite frustrating when you are just starting. From personal experience, I can tell you that trying to figure out how all the settings work in Blender by trial and error is hard and takes a lot of time.
If you feel overwhelmed by the hundreds of settings and values in Blender’s fluid simulator, there is no need to worry! The goal of this chapter is to ease you into working with Mantaflow and to help you get a basic understanding of what creating a simulation looks like.
If you didn’t know, Mantaflow is Blender’s fluid and smoke simulator. In this chapter, we will discuss how it was developed, what you can create using it, and what you need to get started creating a simulation. Finally, we will create a fire simulation together. Step by step, we will go through all the settings and render out an animation so that you can upload and share it!
In this chapter, we will cover the following topics:
- What is Mantaflow?
- Gas and liquid simulations
- What you need to create a simulation
- Creating your first simulation
Technical requirements
This chapter requires you to have Blender version 3.0 or above installed. To download Blender, visit www.blender.org.
You can find the assets for this chapter in this book’s GitHub repository: https://github.com/PacktPublishing/Learn-Blender-Simulations-the-Right-Way/tree/main/Chapter01.
What is Mantaflow?
Mantaflow was introduced in Blender 2.82 and has seen many updates since then. It was first developed back in 2009 at the ETH Computer Graphics Laboratory. Now, it’s being maintained and developed by the Thuerey group at the Technical University of Munich (TUM).
In Blender version 2.81 and below, the smoke and fluid simulations were two completely different things, and they weren’t very compatible with each other. When 2.82 came out, the Blender developers removed these two simulations and introduced Mantaflow. This was a much better system because it combined both the fluid and smoke simulations into one.
To enable Mantaflow on an object, you need to head over to the Physics Properties area (it will look like a circle with a dot in the middle) and select Fluid:

Figure 1.1 – Blender’s Physics Properties area
Don’t get confused when you only see Fluid in Blender’s Physics panel. Fluid is just the name used for the overall simulation. Once you select it, you’ll be able to choose between Gas or Liquid.
Now that we’ve covered what Mantaflow is, let’s take a look at the simulations you can create with it in Blender!
Gas and liquid simulations
You’ve seen me throw around the terms gas, liquid, and fluid, but what are the differences? As mentioned previously, the term fluid is used to describe the entire simulation. Inside the simulation, there are two options to choose from:
- Gas is the name Mantaflow uses for smoke and fire simulations
- Liquid is just the name to describe fluid simulations
Let’s talk about each one separately so that you can understand the differences and how each one works.
Gas simulations
Gas simulations allow you to create smoke and fire in Blender. But what can you do with it? Well, you can combine fire and smoke to create a massive explosion. Other examples might include a flamethrower, campfire, steam, mist, or fog – there so are many things that you can create, and the possibilities are almost endless. The following figure shows what we will learn to create in Chapter 5, Creating a Realistic Explosion:

Figure 1.2 – Explosion example
Smoke and fire simulations are made up of what we call voxels. You can think of a voxel as a 3D pixel of the simulation. The smaller the pixel, the better the simulation will look. You can change the size of these voxels by increasing the resolution of a simulation. Higher values will make the simulation more detailed, but that will also cause the simulation to run slower and take longer to bake:

Figure 1.3 – Example of a voxel
In the preceding screenshot, the left simulation has a resolution of 8. This is quite small, so that is why the voxel is very large. The simulation on the right has a resolution of 64 and, as you can see, the voxel size is much smaller. You can also tell the size of the voxel by looking at the bottom-left corner of the domain object:

Figure 1.4 – Domain voxel size
The domain is the container for the entire simulation. We will cover them in detail in the What you need to create a simulation section.
These voxels represent all the attributes of the simulations such as heat, density, temperature, and velocity, just to name a few.
What is an attribute?
An attribute is simply a term used to describe data that is being stored. You can take this data and use it to influence materials, modifiers, and more.
The smoke that gets created in the domain can be from either a mesh or a particle system. These objects that emit smoke are called flows. They are used to add or remove smoke from the domain. Using a particle system as the emitter, you can easily create an explosion, which we will learn about in Chapter 5, Creating a Realistic Explosion!
The movement of the smoke or fluid is controlled by the flow of air. The airflow can be controlled by the following properties:
- The settings inside the Domain object, such as Density and Heat, which set how fast the smoke will rise.
- Effectors, which are mesh objects that will collide with the smoke, restricting its movement.
- Flow objects, which can affect how fast or slow the movement will be.
- Force fields, which also offer a way to affect the movement of the smoke. Depending on which force field you add, you can give your simulation a much more dynamic and interesting look! For example, the Wind force field will give a constant force in the direction you point it in. This can be very useful for adding just a little bit of movement to the smoke and making it look a lot more interesting!
Now that we have covered gas simulations, let’s talk about liquid simulations.
Liquid simulations
Liquid simulations are very powerful, and there are many things you can do with them. Do you want to have a glass explode when it hits the ground, causing fluid to fly everywhere? What about creating a waterfall, waves, lava, or honey? All of this is possible with the liquid simulation:

Figure 1.5 – Waterfall example
These simulations are used to simulate the real physics and behavior of fluids. Unlike the gas simulation, if you increase the resolution of the fluid, it will add geometry to the scene:

Figure 1.6 – Fluid resolution example
In the preceding screenshot, the left-hand side has a resolution of 96; on the right, it’s set at 32. The left-hand side looks highly detailed with a lot of geometry, creating lots of splashes. However, the right-hand side has low detail, giving the look of low poly. Sometimes, a lower resolution might be what you are going for; it all depends on what you are trying to create.
The fluid can only be emitted into the domain using a mesh object such as a cube, sphere, or plane. Particle systems will not work for fluid simulations.
Increasing the resolution of fluid will drastically change the vertex count
The vertex count went from around 8,000 up to 200,000, just by increasing the resolution by 64. This will add to the total memory of the scene, making Blender run a bit slower. You can view the total memory of the scene by right-clicking on the Status Bar area at the bottom of the screen and selecting System Memory.
Both gas and liquid simulations are powerful, and they allow you to create so many different things very easily. Now that we’ve covered the differences between them, let’s get into what you need to create simulations!
What you need to create a simulation
In short, there are two things you will always need for a Mantaflow simulation, as follows:
- A domain
- A flow object
We will look at each in more detail, along with effectors, which are not mandatory but are still useful.
Domain objects
A domain object is a container for the entire simulation. No gas or liquid will be allowed outside this domain. When the simulation gets close to the edge, it will either collide or disappear, depending on what setting you have set.
The bigger the domain, the more resolution you will need
This will cause the simulation to bake longer. A general rule is to have the domain just big enough to fit the simulation.
The domain object is always going to be the shape of a cube. Even if the domain isn’t a cube, the simulation will treat it as one and will simulate outside the original mesh:

Figure 1.7 – Domain example
The sphere in this example is the domain and, as you can see, the fluid is going outside the mesh. It is probably best to only use a cube as the domain for any simulation. As I stated earlier, you can also see the resolution of the simulation by viewing the size of the little box in the bottom-left corner.
To assign a domain, go to the Physics panel and select Fluid | Type | Domain.
Flow objects
Flow objects are used in simulations to either add or remove fluid from the domain. It’s important to note that the flow needs to be inside the domain to simulate properly; having it outside will do nothing.
Unlike the domain, with a flow object, you can have any shape you want but it needs to be a (mesh object). This means that
(curves),
(metaballs),
(empties), or other objects like that will not work:

Figure 1.8 – Flow examples
We will cover flow objects in detail in Chapter 2, Understanding Domains, Flows, and Effectors, but I wanted to provide this example so that you can understand how they work. In the flow’s properties, you can change its Behavior. There are three options you can choose from. This will affect how the smoke/fluid is emitted into the domain:
- Inflows: This will constantly add fluid to the simulation (left)
- Geometry: The fluid added is based on the exact amount of geometry of the mesh itself.
- Outflows: This will delete the fluid
To assign a flow object, go to Physics Properties | Fluid | Type | Flow.
Effectors
Effector objects aren’t necessary to create a simulation, but they can add another level of detail and interest to your simulation. They are used to collide and deflect or change the physics and velocity of the fluid.
So, if you want to create a collision for your simulation, effectors are the way to do it. When you add one in, just like the flow, this object needs to be a mesh. We will cover effectors in detail in the next chapter.
To assign an effector object, go to Physics Properties | Fluid | Type | Effector.
To summarize, there are two types of simulations that you can create with Mantaflow: either a gas or liquid simulation. When you decide which one you want, the next step is to add all the objects you need, those being a domain and a flow object. Do you want multiple flow objects? Do you want to add any collision objects to give more interest to the simulation? There are an endless number of simulations that you can create and it’s up to you to decide what you want to do.
In the last part of this chapter, we will be creating a fire simulation together. Step by step, we will learn exactly what it takes to create fire using Blender and Mantaflow. So, strap in, open Blender, and let’s get started!
Creating your first simulation
Now that we understand what creating a Mantaflow simulation in Blender looks like, let’s create one together. In this section, we will go through the entire process of creating a fire simulation in Blender; this process will include doing the following:
- Adding the objects
- Creating the simulation
- Creating a material for the fire
- Setting up the camera
- Rendering the animation
This may sound like a lot, but don’t get overwhelmed. I will be going through every step and together, we will create something awesome! This section is aimed at beginners, but it also assumes you have basic knowledge of Blender’s interface and how to use it.
With that out of the way, let’s get started!
Adding the objects
Let’s start by adding the objects we will need in the scene. Remember, we need a domain object and a flow object for every simulation. With the default scene open in Blender, we already have a cube that we can use for the domain object. Currently, it’s a bit small, so let’s scale it up:
- To scale an object in Blender, make sure it’s selected and press S. You can now move your mouse to scale the cube, or you can type a number in. Let’s scale the cube by 2 and then press Enter. I also think it can be a bit taller, so let’s scale it along the Z axis. To do this, press S, then Z, and then use 1.5 as the value.
- Once you are happy with the scale of your object, you can add the flow. You can use whatever object you like but for my simulation, I’m going to add a UV sphere. Press Shift + A, then select Mesh | UV Sphere. Scale it down to around 0.75 and place it near the bottom of the domain.
If you did all that correctly, it should look something like this:

Figure 1.9 – Domain and flow
Now that we have our objects in place, it’s time to start working with the domain and flow!
Creating the simulation
Everything is in place, so the next step is to assign the cube as a domain object and change the settings. After that, we will create the flow and edit some of the values.
Domain
Let’s start by setting up our domain object:
- Select your domain and head over to the Physics Properties panel on the right-hand side (it should look like a circle with another circle inside it):

Figure 1.10 – The Physics Properties panel
- Once you’re there, click on Fluid, and for Type, select Domain.
(Yes, I know, there are quite a lot of settings; let’s take it one step at a time.)
- The first thing we should do is change the cache type. Scroll down until you see the Cache panel. We don’t need to bake in 250 frames, so let’s set the End Frame property of the simulation to 150. As for Type, let’s select Modular and check the box that says Is Resumable. This will allow us to stop the bake halfway through if we need to.
The Cache panel should look like this:

Figure 1.11 – Cache
- Now, let’s set up the other Domain settings. Starting at the very top, set Resolution Divisions to 128. This will give us a nice, high-quality fire:

Figure 1.12 – Resolution Divisions
- Check the Adaptive Domain box. This will change the size of the domain based on where the fire is, which, in turn, will decrease the bake time:

Figure 1.13 – Adaptive Domain
We can leave all the default settings as-is.
- In the Gas panel, open the Fire section. Reaction Speed controls the height of the flames. Higher values = lower flames, while lower values = taller flames. Let’s set it a bit lower to 0.5:

Figure 1.14 – Fire settings
- (Optional) If you want more swirls in your fire, you can turn up the Vorticity amount in the flames to 0.6 or 0.7. Don’t set it too high or your fire will go crazy!
The domain settings are now done; the next step is the flow object!
Flow object
Now that our domain is all set up, it’s time for the flow object:
- Select your sphere and in the Physics Properties panel, select Fluid. As you’ve probably guessed, set Type to Flow.
- As for Flow Type, change it from Smoke to Fire.
- Currently, Flow Behavior is set to Geometry. With it set to Geometry, the fire will disappear very quickly when we play the animation. However, we want it to constantly add fire, so let’s change it to Inflow.
- We can bring up Fuel to 1.3. This will make the fire a bit taller and move more quickly.
- In the Flow Source section, Surface Emission is currently at 1.5. This means that the fire will emit slightly away from the mesh surface. I would rather have it closer to the mesh, so let’s set this value to 1.
- With all that done, we are ready to bake our simulation! Select your domain and click the big Bake Data button at the top to start baking the simulation. Keep in mind that this might take a little bit of time, depending on how fast your computer is.
Now, all we have to do is sit back and wait for it to finish baking. Once it’s done, we can create the fire material!
Creating the material
Creating a basic fire material is pretty simple and easy to do:
- With the Domain object selected, let’s jump over to the Material Properties panel (it will look like a red circle):

Figure 1.15 – Material Properties
The base Principled Shader is what we call a Surface Shader. This controls the colors, textures, and light bounces on the surface. This won’t work for fire, so let’s remove it.
- Click on Surface Principled BSDF (it will have a green dot next to it) and select Remove.
- What we need instead is a Volume Shader. These kinds of shaders are for the interior of a mesh or fire and smoke. So, let’s add one. Open the Volume panel and select Principled Volume:

Figure 1.16 – Volume Shader
- The first color option is for the smoke. Pick whichever color you want; I’m going to set mine to a slightly darker gray.
- You can also set the Density property higher if you want more dense smoke. For my final result, I set my density to 8.
- There are many ways to create fire. The most basic way is to turn up Blackbody intensity. You will notice that if you drag it up, you can only go to 1, but if you type a number in manually, then you can go higher. The higher you set this, the brighter the fire will appear. I’m going to set mine to 7.
And that’s it! You’ve created your fire material. Now, let’s set up our camera so that we can see the fire! If you aren’t happy with the look, you can always come back later and change it.
Setting up the camera
Our fire is looking good so far! Now, we need a way to see it! Let’s set up the camera and position it where we want:
- Press 0 on your Numpad to go into Camera View or go up to View | Cameras | Active Camera.
- To move the camera around easily, go into the Properties Panel (N) section and, in the View tab, check the Camera to View checkbox. Now, you can move the camera around just like how you would move around the 3D space:

Figure 1.17 – Camera
- Move the camera to where you can see the entire simulation. Then, make sure to uncheck Camera to View; otherwise, you may accidentally move the camera when you don’t mean to.
- As for the lighting for the scene, let’s jump over to the World settings and set Color to black:

Figure 1.18 – World lighting
Now that our camera, lighting, and material are all done, it’s time to set up the render settings!
Rendering the animation
Now would be a good time to match the simulation to the end frame. Since we baked 150 frames, let’s set the End Frame property in the timeline to 150 as well:

Figure 1.19 – Timeline example
Next, let’s choose which rendering engine to use. There are two default render engines to choose from in Blender: Eevee and Cycles. Both have their strengths and weaknesses. For example, Eevee will render much faster than Cycles, but the fire won’t look as good. If you have a slower computer, I recommend using Eevee because rendering smoke/fire in Cycles is pretty GPU/CPU-intensive. To choose a rendering engine, head over to the Render Properties section and click Render Engine:

Figure 1.20 – Render Engine
For my animation, I used Eevee, but if you want to use Cycles, I will provide instructions for both!
Cycles
With the Cycles engine selected, let’s change some of the settings so that Blender will render faster and get a better result:
- Open the Sampling panel and in the Render tab, set the number of Max Samples to 20.
- Open the Color Management tab and set Look to High Contrast. This will give the fire a much better look.
Now that you’ve completed the steps for rendering in Cycles, feel free to skip the Eevee instructions and head on over to the Setting the output section!
Eevee
In the coming chapters, we will be learning a lot more about rendering volumes in Eevee! For now, let's go over some basic settings to help the fire look much better. Switch over to the Eevee render engine and let's get started:
- In the Sampling panel, set Render Samples to 128. This will help increase the detail in the fire.
- To add a bit of glow, turn on Bloom. If the glow is too strong you can lower the Intensity value.
- In the Volumetrics tab, set End to 15 and Tile Size to 2px. This will make the fire have more detail and look better.
- If the fire disappeared in the rendered view, make sure you set Distribution to 1.
- Open the Color Management tab and set Look to High Contrast. This will give the look of the fire much more contrast, making the colors stand out a lot more!
The final step in this tutorial is to set up an output for our animation.
Setting the output
Whenever you render an animation in Blender, you need to set an Output folder. To do this, head over to the Output Properties section and set a directory for where you want your animation to render by clicking on the little Open Folder icon on the right. After that, set up the file format of your choosing. I’m going to set mine to FFmpeg Video and Container to MP4. It should look something like this once you are done:

Figure 1.21 – Output
Now, you are ready to render! Go to Render | Render Animation or press Ctrl + F12/Cmd + F12. Once the render has finished, it will be in the output directory you set!
To view my result and download this .blend
file, you can visit https://github.com/PacktPublishing/Learn-Blender-Simulations-the-Right-Way/tree/main/Chapter01. The following is a frame of my simulation:

Figure 1.22 – Final result
And there you have it! You’ve completed the first tutorial of this book. Hopefully, you made it through with ease and learned something new along the way!
Summary
If you have never touched Mantaflow simulations in Blender until today, congratulations on making it through this chapter and creating your first fire simulation!
We covered quite a few topics in this chapter, so let’s recap! First, we learned what Mantaflow is and how it was introduced to Blender. We looked at what creating a simulation is about and the two types to choose from – gas and liquid. We also covered all the objects you can add to your simulations – that is, domains, flows, and effectors.
After that, we worked together and created an awesome fire simulation. Using Mantaflow can be a bit challenging at times but hopefully, this chapter gave you a clear understanding and a boost of confidence to go and create simulations!
I encourage you to open Blender and try to create a simulation and have fun with it! You can do something weird such as setting a monkey's head on fire and having the color of the flames be purple! Or, you could do something a bit more serious such as using force fields to create a tornado effect! The things you can create with Mantaflow are almost endless!
The next chapter is all about the domains, flows, and effectors. We will look at each in detail and talk about their settings so that you understand exactly what values to change to get your desired simulation!