Preparations

Let's start with making the box (Objects>Primitive>Cube) in Cinema4D.

This is the simple box where the entire simulation is happening. The size of the cube in my example is 400m x 400m x 400m. Later we will use the scene scale setting in RealFlow (usually at 0.01 for Cinema4D objects) to fit the "water" exactly inside the box. Now it is needed to make the box editable (turn into polygons), and to use "triangulate" in the functions-menu, since RealFlow expects triangular polygons in all objects. I have set the length of the animation in the timeline to 900 frames. That is already everything we have to prepare for this specific simulation. In principle, it would be possible to animate the object at this stage (while recording keyframes) and the saved animation would be transferred to RealFlow as well.

Next we have to export the object with the SD-export command from the NextLimit plugin menu (Plugins>NextLimit>[NL] RealFlow SD Export). I have set here 900 frames as the duration of the animation, but you can simulate more (or less) frames in RealFlow and simply change the number of frames when you come back to Cinema4D for rendering.

In this dialog, we need to choose first "Save All", then set the file path with the "Outfile" button and finally press "Save SD". The "Vertex All" option is only needed for deforming (soft) objects. Then close the dialog box after the SD-export is done. We will need the C4D-scene again afterwards, so save it and keep it unchanged for the moment.

Then we start up Realflow and create a new project (the project name does not matter). RealFlow now creates a folder structure on the harddisc for the different types of files that can be exported from simulations (cached particles, meshes, objects, animations, images). The SD-file from Cinema4D could now be moved into the "objects"-folder to keep the project files together. When we are about to import an object, we have to check first, if the scale factor and the axis convention is set correctly for our 3D-application, in this case Cinema4D, in the preferences dialog of the program. The Default scale should be at 0.01 and the Axis setup at YXZ:

Now lets import the cube using the SD-file you have just created in cinema4D. This command is in the File menu (File>Import>Import object) or in the "Edit" (Edit>Add>Objects>Import...) menu. The cube should now appear (usually as a wireframe) in the viewports. The cube has already basic settings for the interaction (i.e. collision) with fluid particles, it is not needed to turn on rigid body dynamics for the cube in this project.

The liquid emitter

The next thing is the setup of the particle/liquid emitter. Let's add one (Edit>Add>Emitters>Square). A rectangle appears. The position, rotation and scale of the emitter can be changed by moving one of the axis in the respective mode, which is enabled with these switches on the upper left border of the main program window:

The new emitter appeared in the list of "Nodes" and in the "Global links" table. Each new element will appear in these two tables first. The middle table (exclusive links) has the function of defining links only between specific elements. For example, a certain force should act only on selected objects in the project. Do do so, the elements have to be moved inside the middle table and to be removed from the global table. This is not needed for our current project here: we will use only one object (the cube), two forces, one emitter and a mesh. All the forces/daemons will act on the fluid and the fluid will react to the object (the cube). The daemons would also act on the cube in principle, but because we did not specifiy the cube as a rigid body object it won't move at all. We don't use exclusive links here, but we are going to animate the position and strength of the forces instead.

The next step is the setup of the emitter and the production of liquid particles. For our animation the square emitter (still empty at the moment) should fit inside the cube with some distance to the walls and to the floor of the cube.

The "volume" setting of an emitter is by default at 0 and that means the emitter will send out particles during simulation at a rate given in the speed setting, and until the "Max particles" are reached. However here, I have set the volume to a value >0 and RealFlow fills this volume at once with the full amount of particles. Therefore we will start the simulation with a block of liquid already present in the scene.

5

There are some settings in the emitter panel which I have changed compared to the default values: "Resolution" is set higher to provide more detail. "Density" is higher to let the liquid react to forces in a more "heavy" and "flowing" way. The balance of internal and external pressure has a big influence on the look of the liquids and these settings also determine the strenght of interaction between particles. By applying more external than internal pressure, we can achieve a liquid which has the tendency to round up in form of droplets and to form smooth surfaces. With a higher internal pressure, we will see a more splashing and exploding liquid. The "surface tension" I left at the default value of 0 and used instead the "surface tension"-daemon which has more options. This daemon makes the liquid form a spheroid shape. Down in the "Square"-tab there is the volume of the rectangular block of liquid (0.8). This determines, how many particles are present, because the particle resolution and the size of the block determine the amount of particles, not the density parameter. "V random" and "H random" add randomness to the distribution of particles in the initial geometry of the liquid.

The mesh/liquid-surface

Then, the mesh/liquid surface has to be added. Select the Mesh01 in the Nodes list, use the right-mouse-button menu and the "Insert fluids" command which allows you to choose emitted particles that will be enclosed by the mesh. The default settings for the mesh are good for a rather viscous-looking, thick liquid. A more realistic mesh for water can be generated with the filtering options and the other mesh settings. From your 3D-software you are maybe already familiar with the concept of "metaballs", a technique to have a surface created around particles for bubbles and other organic-looking things. RealFlow uses this method, but you can achieve much better liquid surfaces than with the built-in metaball functions of Cinema4D or other 3D-packages.

The "Polygon size" setting determines the polygon-resolution of the mesh. For this project I would use a relatively small value, because we are expecting some tiny droplets which should have a smooth surface. The finer the polygon mesh, the bigger in megabytes the mesh bin-files will be. "Texture" we don't need for this project. The next setting in the list is more important: I always recommend to turn on "Filter method", which takes away most of the "blobbiness" from the liquids.

The "Relaxation" Filter seems to have a very similar effect as the mesh "blend factor" (see below), but the outcome is different. A higher relaxation value makes the mesh shrink to the core of the particle cloud so that the mesh appears thinned or even spikey. The blend factor on the other hand can be increased to produce a larger shape. The blend factor and additional mesh-settings are shown in the node params, when we select not the mesh but the emitter inside the mesh:

meshsetting

"Noise" applies a certain amount of randomization on the mesh, similar to the displacement that is often used in 3D-applications in the rendering step. Deformation settings: "Speed stretching" and "flattening" apply some distortion to the mesh depending on the direction and speed of the particle movement. The maximum stretch scale is 2.

The daemons

Now, the most important "players" in this animation have to be prepared: the forces or daemons as they are called in RealFlow. Not all of the daemons are actually forces. Those with a "k" in front of the name can kill particles depending on a certain conditions and/or within boundaries. A gravity daemon is always useful to have. It provides natural gravity in the scene. But it can be used as a general unidirectional force, for example, if the liquid should rise into the air, its axis could be turned around or you could apply negative values for the strength setting. Just use the add command (Edit>Add>Daemons>Gravity) to get a gravity daemon. The strength of gravity can be animated. The position of the daemon does not matter as long as we don't use specific limits as boundary. Just leave it at default values for the moment. These fields are colored on the screenshots here, because the values were already animated (we come back to that in the next subchapter).

The "attractor" daemon provides a center of attraction in space. Without the influence of any other force, a sphere of liquid will form around an attractor. If the attraction force is strong, the liquids will gain speed when rushing to the attractor and overshoot it, until coming back and forming a sphere around it. When the attractor is moved slowly, the water "droplet" moves as well. If the attractor loses its force, the droplet may fall down under the influence of the gravity daemon. If the force of the attractor changes too quickly, "pressurized" liquid can explode. And finally, particles will be pushed away, when the force of the attractor is negative. For this animation the spherical or the planetary type is useful. The setting "Bounded" yes/no has a big impact on the animation as well: a not bounded attractor affects all particles, a bounded attractor just acts inside the region indicated by the green circles. "Attenuated" means that the force loses strength depending on the distance to the center (which is the normal behavior of forces in nature).

The "drag force" daemon provides a force pushing on the liquid. This can be used to push away the liquid from a specific location or, as in our example here, as a general force pushing from the outside of the liquid and the result is, that the liquid stays more together and forms a spherical droplet for example (To use this daemon was a tip from M. Shea, www.shea-design.com/). If this daemon is used as general force without boundary and with shielding=off, then the actual location in the scene does not matter.

The "surface tension" daemon acts as a general force on the simulation of the surface of the liquid. It helps to form small droplets and can make the liquid look more natural. A too high value for this daemon makes the liquid look like mercury and might also increase a trembling movement of the surface, which is unwanted in most cases.

attractor

Animating the daemons: keyframes and curves

There are basically two methods to set a keyframes inside RealFlow: The simple keyframes (Position Key, Rotation Key, Scale Key) and the curve editor. With the curve editor you can set all accessible parameters of a specific daemon or object, but it is also possible to set keyframes first and then modify the animation by shaping the animation curve in the respective curve-window. Also the strength of the daemon, not only its motion can be keyframed. Animated parameters will show a brownish background in the settings panel. All these preparations happen before the liquid simulation starts, just to make that clear. When you have created a key you can right-click on the field for that parameter, select "Open curve" and you should see the curve of the selected parameter in the curve editor. On the left you see a list of possible parameters. If you would like to have the forces changing more abruptly or smoothly, just move the handles of the curve . Sometimes the curve is not completely visible. In this case you can use the "fit" commands in the pull-down menu bar. Finally, the entire animation can be tested by playing with the timeline at the bottom of the main RealFlow window (without simulation, just using the arrow buttons). I have summarized these animation functions in this little movie taken from the screen: animation

It is actually the real fun of this type of simulations, that you animate the position and force of a daemon and the outcome is always a surprise !

Export options

These settings are in the dialog "Export Central" in the Export menu. Do not forget to select the export options before running the simulation to have at least the meshes (Mesh01) exported to the harddisk. You could also store the particles themselves (EMITTERS>Square01). This would allow to reload them again and apply a new mesh with different settings and save calculating time in the simulation step. However, the particles produce rather large files on the harddisc and for a first liquid test, it is not necessary. The export central is also the place to export object animation. The simulated dynamic motion of objects is stored in the animation.sd (the name in RF version 3 was dynamics.sd). In addition you can export the animation in the format of sd-files for single objects, and you can export the geometry of objects in the OBJ-format. This is necessary, of course, if the objects were created inside RealFlow and not imported from a 3D-application.


Let the simulation begin

You can find some simulation settings in the preferences (those are mainly thought for new scenes) or by using the fly-out menu next to the "Simulate"-button. In this project we don't animate objects but fluid dynamics.

The simulation settings have a big impact on the speed and accuracy of the simulation. The settings shown above are for high quality. If the simulation is too slow for your taste, the MAX setting can be reduced to 50, for example. Simulations can become less stable with fewer substeps, collision detection might be less accurate and the program may eventually crash. An alternative to reducing the substeps is to test first with fewer particles and do a simulation at higher resolution later (which will have a different result to a certain extent). Move the timeline to the start and let the simulation begin !