Create custom simulations

Feedback ports on compounds can be used to cache the result of the last evaluation of a subgraph, and use it as the input for the next evaluation. This is how simulations work, where the result of one frame is the basis for the next frame.

Feedback ports consist of a pair of input and output ports on a compound that are matched so that the output value is used as the input the next time the compound or the whole graph is evaluated.

Important:

To ensure that the graph gets evaluated each time you advance a frame, it must have an input that changes value. For example, there must be a time node or an animated input from the host scene.

To see an example of how this works, look inside the simulation_example compound. It provides a template for a generic simulation that you can make editable and modify for your needs.

To create a pair of feedback ports on a compound:

  1. Make sure that the compound has matching input and output ports of the same type. Note that any ports are not supported. If necessary, right-click on the ports and choose Set Value Type to set an explicit type.
  2. Inside the compound, right click on either the input or output port, choose Set Feedback Port, and select the matching port.

For best results, your custom simulation should: