Houdini Dynamics and Effects
Magnet Force: Metaball Dynamics Simulation (with Billiard Balls)


This workflow demonstrates the use of magent force simulation with Houdini.

The result is a strong and fluid movement of objects to and from origin.

For this example, spheres are pushed and pulled using a magnet force dop network.

Once keyframed, the resulting animation exhibits an ideal example of magnet force behavior.

To enhnace visual clarity of object movement, textures in the form of cue balls are added to the geometry.

Click Figure 01's caption or this link for full resolution video.

Figure 01: Magnet Force Cue Ball Simulation

The Rigid Body Point Object shelf tool is used to scatter geometry across a number of points.

This tool requires first the geometry in which to scatter, and second a volume of points. These points will be where the copied first geometry object instances will be scattered to ( Figure 02 ).

To allow the addition of texture materials to the geometry primitives later on, UVs can be laid out on the geometry object.

RDB Point Object instances the sphere, so it is best for the UVs to be laid now ( those UVs will come in handy later when materials are applied ).

 


Figure 02: Primitive to Copy and Target Points for RDB Point Object Tool

For the source points, a scatter SOP is used to scatter points within a volume. This SOP computes nearest point ( Average of N nearest ).

The attribute Average of N nearest, named and placed with a point SOP, serves as a radius for each sphere once they are copied. With this done the copied spheres will not overlap or intersect.

With the points scattered and their unique pscale attribute in existance, the scene is ready for the RDB shelf tools use.

The tool will create a dop network, and add a dop import SOP to the scattered point geometry object ( Figure 03 ).

The next step would be to create the metaball geometry that will serve as the source and container for magnet force.

 


Figure 03: RDB Tool Geometry Copy Result

The metaball is transformed slightly. Since the ball serves as the center in which the spheres will attract, moving it even slightly will have a visible result on the final simulation.

The method for translating the metaball used in this example is a Motion Effects Chop Network.

This method creates a Motion Effects Chop Network from the metaball nodes translate parms. Noise is added within this CHOP network. The application of noise to translation value can be seen in the Motion View Pane ( Figure 04 ).

Once the metaball is animated, the Houdini Magnet Force shelf tool can be used. The metaball serves as the force field in which the spheres will be constrained.

If Magnet Force is applied properly, a new operator called magnetforce1 will be added to the dop network tree.


Figure 04: Motion View of Metaball xForm Motion Effects Noise


The scale of force in the magnetforce operator can be keyframed ( Figure 05 ). This parameter will adjust the proximity of the spheres to origin.

This creates the push and pull aspect of the simulation.

Another addition to the simulation would be another force that can slightly boost the rotation of the spheres. A uniform force operator will server for this purpose.

A fraction of noise is added via the uniform force operator. This increases variation in rotation among spheres.

For a final adjustment, a drag force operator is used to adjust velocity-related parameters ( for this example, Torque ).

Figure 05: Channel Editor Pane of MagnetForce Force Scale Parameter


Patterns and textures will provide real appeal to the motion within this simulation. For this example, a custom attribute is added to each sphere with the AttribCreate operator (this is done within the instanced spheres/points geo object, after the dopimport operator).

This operator applies a string parameter to each sphere. The string itself is created through concatenation of the project's working directory, an increment variable, and a filetype extension.

An example of string concatenation: $HIP/img_directory. + rand($OBJID) + 1 + .png

If concatentation and the file location and name conventions are consistent, a texture can will be applied randomly to each sphere from that directory.

(File names, concatenation, and increment iterations must be exact. This custom attribute string that is being concatenated is the path to the image file(s). Understandable, it must be exact).




Note:
Another element that will really sell the motion of this simulation is motion blur. Adding velocity and object motion blur will really sell the movement of the spheres when combined with texture patterns (as this example demonstrates with cue ball textures).

Figure 06: Example Texture File for Material SOP