Dancing Smarties

RealFlow's force-based daemons are not exclusive to fluids, but they also affect rigid and soft bodies. Very nice effects can be achieved with rigid bodies and the “DSpline” daemon: in this short tutorial we want to make 40 chocolate buttons (also known as “M&M” or “Smarties”) follow a given path. When the objects are attracted by the daemons's forces they will organize themselves and form a tail-like arrangement.

 

The result of the tutorial has been rendered with RealFlow's implementation of Maxwell Render.

 

Here is the nodes list:

  • 40 “Smartie” objects
  • 1 “DSpline” daemon
  • 1 “Drag Force” daemon
  • 1 “Camera” node

All elements, except the Smarties can be added from RealFlow's “Edit” menu:

  • Add > Daemons | Camera

The Smarties can be created in your 3D software and exported as an Alembic or SD file. In RealFlow, objects are imported with

  • Ctrl/Cmd + I
  • RealFlow nodes can be moved, scaled, and rotated with the WR, and E keys.
  • Imported objects from SD files have to be unlocked before they can be transformed with Selected object > Node Params > Node > SD ↔ Curve
  • Viewport perspective is changed with the 1, 23, and 4 keys.
  • Shading modes are toggled with the 789, and 0 keys.

Preparing the Smarties Objects

This should be the first action to get a feeling for the “DSpline” daemon's dimensions.

  • Ctrl + I > load the SD or ABC file with the objects

  • Select the imported objects > right-click on one of it > Group

  • Group node > right-click > Rename > Smarties

  • Group node > Node Params > Node > SD ↔ Curve

  • Group node > Node Params > Node > Dynamics > Active rigid body

  • Group node > Node Params > Node > Rigid body > @ mass > 5.0

@ mass” strongly depends on your objects' size and the scene's scale, and you probably have to perform a few tests later to find out a working value.



The “DSpline” Setup

By default, this daemon provides three, so-called control points (“CP”). The control points can be made editable and repositioned to describe the spline's shape. Of course, it is also possible to add new control points. The daemon's yellow circles are the boundaries of its force field; the field itself looks like a tube along the spline. To make the field visible, go to

  • DSpline01 > Node Params > Display Force Field > Show field > Yes

  • Change the field box's “@ position” and “@ scale” to get a view of the entire spline.


All control points can be addressed individually or globally with the parameters in the “Dspline” tab's upper half. These parameters act like multipliers for “@ ...” values.

  • Add the daemon and rotate it by 90 degrees to align its axis horizontally. This will be the objects' main direction of motion.

  • Click on “EDIT” to make the control points accessible. They are numbered and you can browse through them under “@ CP index”. Alternatively, click on a control point in the viewport, e.g. with the “Move” tool (press W).

  • Add two new control points with “Insert CP”.

  • Reposition the control points with the “Move” tool to describe a 3D path. The best way to do this is to use RealFlow's orthogonal views (side, front, top).

  • Control points 1-5 > @ CP radius > 4.0

  • Click on “EDIT” to lock the points

  • Axial strength > 1.0 attracts the objects to the spline. Negative values create a repulsion.

  • Radial strength > 40.0 attracts the objects to the control points. Negative values create a repulsion.

It is likely that you have to use different “strength” values, because they depend on the objects' “@ mass” settings. The control points can be repositioned at any time, but please bear in mind that it is not possible to rotate them.



The Smarties Setup

The bodies' physical properties have been adjusted in the first step already, and now it is time to position them. Use the M key for this action. Make sure that they do not interpenetrate.

It is important that the Smarties are not grouped around the daemon's first control point directly, because otherwise they will not move as expected. They should be arranged like in the image below. There, the nodes are still in the control point's area of influence and become accelerated. If some objects remain immobile during the simulation, increase the first control point's “@ radius” value to include all of the Smarties.

It is not necessary to rotate the objects, but please feel free to do so if you want.

 

Test Simulations

As with any RealFlow project, tests are a very important part of the simulation process. They are required to adjust forces, physical properties, velocities, etc. to get the desired look and behaviour.

  • Simulate

  • Adjust the daemon's “Axial strength” and “Radial strength”, and the Smarties “@ mass” values.

If the objects are too fast then they will overshoot and not follow the spline's path as expected. In this case add a “Drag Force” daemon and increase its strength:

  • DragForce01 > Node Params > Drag Force > Drag strength > 0.4

The final value depends on the “DSpline” daemon's forces and the objects' masses. The value used here is just a starting point. Please change “Drag strength” within small steps, because it has strong influence on the bodies' speed.

The Camera Setup

In the last step, add a “Camera” and animate it to make it follow the object stream. In this scene, the camera's “Position” and “Look At” values should be animated: 

  • Drag the timeline slider to frame where the animation should start.

  • Right-click on Node Params > Node > Position > Add key to create keys for all three axes.

  • Repeat the last step for the “Look At” parameter.

  • Shift the timeline slider to the next frame and set new keys.

  • Repeat these steps for the rest of the simulation range,

  • Open Layout > Export Central

  • Look for “CAMERAS”, check “SceneCamera01” and open its branch.

  • Check “Animation (.sd)” and/or “Alembic Animation (.abc)” to activate the camera's export resources.

  • Simulate