Houdini Engine 1.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Dynamics Simulations

There is not much on the API side that you specifically need to do to enable DOP (the Houdini dynamics framework) assets. However, in order for assets that make use of DOPs to work well inside of your host, there are a few things to look out for.

Start Time

There needs to be a way in the host application to set the current time to 0. Time 0 is of special significance, because it is the start time of many DOPs assets. When the current time is set to the start time (0), the internal DOPs caches are cleared. Without starting at the proper start time, DOPs assets won’t simulate correctly in your host.

Simple Asset

We’ll look at the remaining requirements for an "Engine friendly" DOP asset by dissecting an example.

The example we’ll look at is called "BreakAndSim". This asset takes some input geometry, shatters it, and drops the shattered pieces onto a ground plane. When we dive into the asset, we see the following:


From a high level, the asset works as follows:

  • The BreakAndSimulate object contains a SOP network, that brings in geometry from the host, shatters it, and finally extracts the results of the simulation.
  • The AutoDopNetwork contains the DOPs network. It gets the geometry to simulate from the BreakAndSimulate SOP network.
  • The BrokenGeo and InstancePoints objects are to make the results of the simulation easily accessible through HAPI.
  • The fetch object is there to get the transform of the marshalled in geometry. It will be explained in detail later.

When we dive into the BreakAndSimulate object, we see the following network:


We have an exposed object merge node named "Input_Geometry" at the top. This geometry is fractured into pieces, fed into the DOP network, and the results extracted via the "dopimport1" node.

Center Pivot

In the dopimport node, where you import the results of your DOPs simulation back into the SOP context, be sure to turn on the "Center at Pivot" flag:


Without this flag, the geometry involved in a DOPs simulation would be described in world coordinates, often introducing pivot points that are far away. While this may be fine for some purposes, such as film, where the required data always falls on an exact frame, baked data from such simulations does not interpolate well between frames - the large pivot value leads to very visible jittering artifacts.

Note that this feature is only available in Houdini 13 or later - which means that DOPs assets created in earlier versions of Houdini will unfortunately suffer from the large pivot problem.

Working with External Geometry

As we’ve discussed in Marshalling Geometry Into Houdini, Houdini Engine allows geometry to be marshalled from the host. In order for a DOPs enabled asset to effectively work with geometry marshalled in from the host, a few setup steps are necessary.

Recall that the way to bring in external geometry is through the through the exposed object merge node. If we take a look at the type properties window, we see indeed that the Input_Geometry node has been exposed as an input:


While this gives us access to the raw geometry of what is marshalled in, it does not give us access to the transform to properly position the object in the Houdini scene. To access the transform of the marshalled in geometry, we must make use of a "Fetch" node:


If we look at the settings on the fetch node, we see an expression that is a relative path, pointing to inside the "BreakAndSimulate" object node that is directly parented under the fetch node.

When we select the Input_Geometry node and look at its parameters, we see the following:


Notice the parameter name of the "Object1" field is the "objpath1" that was being referred to by the fetch object earlier. When you’re creating the asset, the value of the "objpath1" parameter can be blank or set to anything you wish to test the asset. When the asset is instantiated inside of Houdini Engine however, its value is controlled by Houdini Engine (due to the fact that this object merge node has been explicitly exposed as an input), and it will be filled in at runtime to point to the geometry object that was marshalled in. In this way, the fetch object at the higher level is able to access the transform of the object that was marshalled in from the host.

Finally, in the DOP network (AutoDOPNetwork node):


Be sure to turn on "Use Object Transform", so that the transform of the marshalled in geometry makes its way to the DOP simulation:


Outputting the Result to Host

When the simulation is done, you’d want to extract the results for display in the host. In this example, this is achieved with the BrokenGeo object, which contains the shattered geometry, and the InstancePoints object, which contains the point cloud information about where each piece should be. Inside of each object is a single object merge node.

BrokenGeo object:


InstancePoints object:


As you can see, these basically are extracting various aspects of the BreakAndSimulate network. The point cloud information inside InstancePoints has a lot of meta-data, in particular the name of the pieces each point is supposed to be referencing:


You can extract all the relevant information via the instancing and attribute access functions.