Fluids
PDFDownloads
No Required Download

Looking for the Blender 2.49 version of this tutorial? Check out the archive.

 

NOTE: In this tutorial, just like nearly all of my tutorials, I have provided what I call keystrokes lines. These are highlighted throughout the tutorial and are meant to allow you to see the actual keystrokes that I went through in order to get the results I get in the tutorial. More advanced users should be able to go through a tutorial without the keystrokes lines assuming I have explained myself sufficiently.

 

            In order to go over as many of the aspects of the fluids system as we can, I recommend downloading the subway I have created already. You do not have to use it if you do not want to, just keep in mind I will be using it to demonstrate how obstacles work. I am just going to continue the tutorial in the assumption that you are using the subway that I am providing, if not you still be able to follow along without a problem. If you haven't already open up the Blender and the subway file (if you are using it) and we can begin. When you open the file it should look something like the image below. Go into camera view should give us a nice shot of the stairs.

 

 

            To start I want to explain about that main parts in creating fluids. The first is the domain. Kind of like in math, this is the area that the water cannot go beyond. Second, we need something that will create the water, similar to a faucet. Another piece, which is optional, is the outflow. This acts just like a drain. Finally we have obstacles, which are also optional. Will we be using all four by the end of this tutorial.

 

            The first thing that I am going to do is hit the 'Z' button. This causes everything to become outlined rather than solid, so we can see better. Now we need to add the domain. I am just going to add a cube and scale it up by a factor of 10. Also, we want to make the domain as small as we can. The larger the domain is, the longer it will take to bake. So bring up the bottom face of the domain by 10 along the Z-axis.

 

            Z, Add-->Mesh-->Cube, Edit Mode (Tab), Select bottom face, G, Z, 10

            Now we need to tell Blender that this is our domain. With our domain selected, go to the Physics settings. This is the right most button in the right hand panel. One of the sections there is labeled Fluid. Click on the Add button there. Then in the Type dropdown, select Domain. We are going to just leave all of the settings at the default.

 

            Select our domain, Go to the Physics buttons, Click Add in the Fluid section

 

            Now we are going to be adding an inflow to our scene. We are going to be using a cube, so let's add one now. To move it into position we are going to put in exact values since it works well in this situation. On the right hand side of the 3D viewing area there is a sidebar with a section labeled Transform. If you do not see this sidebar, you can open it up by clicking on the tiny plus sign in the top right corner of the 3D viewing window. We are going to be changing the Y value to 8.000 and the Z value to 5.000 under Location.

 

            Add-->Mesh-->Cube, Change Location Y to 8.000, Change Location Z to 5.000

 

 

 

            To make our little cube an inflow, we need to go back to the physics settings and to the Fluid section. Click on Add, just like before, and under Type choose Inflow. We also need to change inflow velocity. Generally, a higher emission rate means more water. I am going to make the Z value -2.000. This should be enough to get the water flowing. Now you can test to see that the water is working by selecting our domain and clicking the Bake Fluid Simulation button. You may have to wait a little while for this to work and if you think Blender has frozen up on you, try hitting escape first. There is no indicator on how far the baking is, so it will look like it is just sitting there. (At the time of this writing, I am using the alpha 0 version of 2.5 so it may be different in future versions.)

 

            Select new Cube, Go to Physics settings, Change type to Inflow, Change the Z value under Inflow Velocity to -2.000

 

            The only problem with this is that the fluid is going right through our subway. To fix this we will make it an obstacle. Select our subway, go to the Physics settings, and just like before click on the Add button in the Fluid section. Change the type to Obstacle. When the settings pop up, make sure that the Volume Initiation setting for our obstacle is set to Shell.

            Select the subway, Go to Physics settings, Click the Add button for Fluids, Change Type to Obstacle, Change Volume Initialization to Shell

 

            Ok, we now have our Domain, Inflow, and Obstacle set up and ready to go. If you want to, feel free to Bake the fluids and see what it looks like now. When you are done with that we can start adding the outflow to our scene. For the outflow we are just going to use another cube, so add another one to our scene. Then throw it in one of the corners. After that, go back to the Fluid section in the Physics settings and click on the Add button. This time choose Outflow for the type. There are no settings we need to change for this one.


            Add-->Mesh-->Cube, Move Cube to corner, Click add in Fluid Section, Change type to outflow

 

            At this point, you should be able to bake our scene and see it in action. Fluids should be entering the scene with the inflow cube and it should be reacting to our obstacle, the subway. Lastly, the outflow should be taking out some of the fluids. If you cannot tell if the outflow is working, take it out and bake your scene again to see if there is a difference. More water without the outflow means it was working.

            If your scene is anything like mine, there is a bit of a problem. The fluid is nowhere near the edges of our obstacle. The biggest factor in this is the resolution. A higher resolution will help make the fluids go closer to the edge of the obstacle. Also, I find that changing the Smoothing setting to zero can also make the fluids look closer to the obstacle. Ultimately though, I believe (I'm not 100% sure) that the more complex the obstacle is, the farther away the fluids will be and the simpler, the closer it will be. Technically, the fluids will never actually touch the obstacle.