So, when you get to the fluid simulation area, initally your object is not enabled for fluid simulation.
Enabling it will flag the object so when we call the simulation module, it will “look” for all flagged objects to begin the simulation.
First, for a simulation to be done, we need the domain. The domain of the simulation is a box where the fluid calculation will be done. Try using a cube for the domain, if you use an irregular sized or shape object, only its bounding box will be used, (the length of the sides can be different)
- Resolution: this is a very important property to be selected. It will determine the “detail” of the simulation. Better explained: as we have seen, the calculation is made in cells, each cell having the same properties for the fluid. A resolution of 50 means you will have 50 x 50 x 50 = 125,000 cells for calculation. If the domain object has not all sides of equal length, the longest side will be used, so each cell remains cubic. Higher resolutions improve the detail of the simulation, but also increase the memory used (both RAM and HD) and baking time. You only see this mesh when rendering.
Memory use increases dramatically as you increase resolution:
|Resolution||RAM Memory (Megabytes)|
- Preview-Res: (Preview Resolution) the same as Resolution, but is used on the preview (AltA), and does not influence calculation time (as long it is less than the Resolution). Limited to 100. It's purpose is that a very large real-time simulation would probably freeze Blender. As it is only an approximation, what you see in preview and what you get in Render are not always the same.
- Start – End times: The time in seconds that you want to be baked.
If you set the start time higher than zero ..... .
This time will be distributed among the frames selected for animation in Render|Animation (F10 Scene Buttons)
- Disp. –Qual.: Select what resulting meshes will be displayed in rendering time and in development time.
- Gravity: the acceleration on all the fluid particles. Measured in m/s².
- The fluidsim currently does not support zero gravity in the z axis. Use a very small negative value for gravity if you want to achive a non-gravity fluidsim.
- Viscosity (the combo box with water selected): Selects the viscosity of the fluid. Currently, it is not possible to work with two fluids of different viscosities. All the fluid inside the domain will have the same viscosity.
- Realworld-size: The size of the longest side of the domain, in meters. It will greatly influence the results of the simulation. Depending on Realworld-size, you may have a drop falling on a cup of water, or some tonnes of water falling into a lake.
- Gridlevels: The number of coarsened (with less cells) grids that will be done, for approximations to speed up calculation. Leave at -1 for auto. 3 coarsened grids may cause the simulation to run up to 4 times faster.
- Compressibility: For the calculation of the simulation to be feasible, we need to consider the compressibility of water. Increasing this value may decrease simulation time a bit, but it is not recommended, as it will decrease the realism. Also, large portions of fluid standing may have problems if the compressibility is too high.
Domain Boundary (Bn)
- Boundary Type Settings: (also valid for obstacles)
- Noslip - The fluid cell in contact with the domain boundary is not allowed to move.
- Part - The fluid in contact with the domain boundary receives an attrition force, but is allowed to move. This is defined in PartSlipValue.
- Slip - The fluid in contact with the domain boundary may move freely.
- Tracer Particles: The number of tracer particles that will be put into the fluid at the beginning of the simulation. To display them you will need to create a particle fluid type, which will be discussed later.
- Surface Smoothing: Amount of smoothing to be applied to the fluid surface. 1.0 is standard, 0 is off, while larger values increase the amount of smoothing.
- Generate&Use SpeedVecs: When this button is marked as disabled, no speed vectors will be exported. By default, speed vectors are generated and stored on disk. They can be used to compute image based motion blur with the renderoutput nodes.
- Volume Init Type:
Volume Init will initialize the inner part of the object as fluid, this only works for closed objects.
Init Shell will only initialize a thin layer for all faces of the mesh, this also works for non closed meshes.
Init Both combines volume and shell, the mesh also should be closed. Also see the picture above. As you can see, the only way to use a plane or any non-closed mesh as an obstacle is to set it to Init Shell. If you don´t, you will get bad results.
Volume Init Type is used on other types of objects inside fluid simulation, but the meaning is the same as above
Obstacles are as the name implies, i.e. an object that is placed in the fluid simulation to obstruct the flow. You can only define a mesh to be an obstacle. It can be animated, and the calculation of the fluid will respond accordingly.
- Animated Mesh : If the mesh itself is animated (bones, shapekeys, etc) check this box for it to be computated. The computation will be slower, so only activate it when needed. If only the object is animated, but the mesh remains the same, do not activate this option.
Inflows will inject water inside the domain. The amount of water put inside the domain is defined by both the area of the cross section perpendicular to the flow and the velocity set. Take care to not fill up the entire domain, or the calculations will be severely downgraded.
Outflows will take fluid out the domain. The amount of water put inside the domain is defined by both the area of the cross section perpendicular to the flow and the velocity set.
After clicking on particle, an additional side panel (Particle Panel) will be created. The type of particles created are tracers, i.e., they will follow the fluid stream during the simulation. You do not need to worry about it, the particles will be created in the correct position(s). If you happen to move the object, you will need to delete the particles and create them again. Also, most of the settings, such as Fields and Deflection don´t work on Fluid Particles.
- Size influence: The particles may have different sizes. If zero, all will have the same value. The higher the value, the higher the difference.
- Alpha influence: When a nonzero value is input, bigger particles will be transparent, and smaller ones will be opaque. The higher the value, the higher the difference.
- Bake directory: The directory where particle simulation data will be written. For most cases, the same directory is used for both the particle and fluid simulation data.
The simulation generates two meshes, one called Preview, and other Render.
After you bake, the domain box turns into the simulated fluid. The fluids, inflows, outflows stay intact. If you no longer wish to rebake your simulation, you may delete them if you wish
When you wish to send a baked simulation to someone, you will need to send the .blend file, also all files that are written to the fluidsim / particle directories.
Example of a fluid type in a colision with a cube
This example aims to show many abilities of the fluidsimulation engine. We will simulate the collison of a blob of fluid with a cube. If you follow my notes accordinglly, you will be able to do like these stills.
To be able to do this, you need to know the basics about the Blender interface, how to create and move simple meshes, and how to do keyframe animation with an object.
- Select a cube, set it as a domain, with a low gravity (gravity Z = -0.1)
- Set the directory you wish to save the baked fluid data files in
- Create an isosphere inside the domain, set it as a fluid type
- Create another cube inside the domain cube, set it as an obstacle.
- Go to render settings (F10) and change the end of the animation to a smaller value, say 30.
- Animate the cube so that it will cross the the blob of fluid
- To do this, create a keyframe at frame 1 pressing I, and select LocRotSize
- Go to frame 30 by pressing ↑↑↑, then move the cube to a position where it would have crossed the blob of fluid, and press I, and select LocRotSize
Depending on your processor, it may take some 10 minutes to get it done. Now you have it baked, you can see the results by pressing ← or →, to move between the frames. To get better results, set a waterish material in your fluid, and render in YafRay.
Example of a inflow-outflow setup
This scene will ilustrate the use of inflows and outflows. The setup involves a inflow that injects water in the domain, facing the outflow.
To be able to do this, you need to know the basics about the Blender interface, how to create and move simple meshes, and how to render.
- Create a cube, set it as a domain.
- Set the directory you wish to save the baked fluid.
- Create a cube inside the domain cube, set it as a inflow, and with V(y direction) = 1.00
- Create another cube inside the domain cube, scale it in one axis, set it as an outflow, facing the direction of the inflow, just the the render setup scene.
- Go to the render settings (F10) and change the end of the animation to a smaller value, say 30.
- Create a waterish material (tweak ZTransp settings). Set as smooth the resulting fluid.
- Render the animation.
If you want to control the volume of inflow or outflow over time you can either scale the inflow/outflow object (which you can animate) or move the inflow/outflow object out of the domain.
Fine tuning of properties
Things you can do to improve your fluid meshes when rebaking:
- Increasing the resolution
- Keeping you obstacles, inflows, outflows with less polygons as possible
- Avoind using situations when fluid will be at very high velocities. The calculation time will be high, and results may not be accurate
Things you can do to improve your fluid meshes without rebaking:
- Set the fluid as a smooth surface
- Subsurf the fluid once
Things you can do to improve the overral rendering quality:
- Modify the material of the fluid meshes to get a waterish-like aspect. Use Ztransp to do that.
- Render using a external Raytracer like YafRay or POVRay to get better refractions inside the fluid and caustics