Set up a gel simulation

The source_mpm_gel node is useful for simulating many materials such as icing, toothpaste, ketchup, melted chocolate, and foam, just to name a few possibilities.

MPM gel simulation

Tip:

Check out the sample gel simulations available in the Bifrost Browser. See Get Started with sample graphs.

  1. Get the meshes to use as emitters for the gel, as well as containers and other colliders. These meshes can be input from the scene or created in the graph. For best results:

    • The meshes should be as regular as possible, for example, triangles or quads without any long slivers.
    • The edge lengths should reflect the size of detail that you want in the simulation.
    • If you are using meshes from the scene, you probably want to hide the emitter meshes.
  2. Connect each emitter mesh into the geometry input of a source_mpm_gel node, and set its properties.

    • Use separate source_mpm_gel nodes if you want different meshes to emit with different properties.
    • Connect multiple meshes into the same node for efficiency if you want them to emit in the same way. Optionally, you can also merge them into a single mesh beforehand.
  3. Connect the outputs from the source_mpm_gel nodes into the sources port of a simulate_mpm node.

  4. Connect the ouput of an mpm_solver_settings node into the settings port of the simulate_mpm node, and set its properties.

  5. Connect the meshes that you want to use as obstacles (such as containers for the gel) into collider nodes. You can connect all the collider meshes into a single node if you want them to have the same properties, or into different nodes if you want different colliders to have different properties.

  6. Connect the outputs of the collider nodes into the colliders input of the simulate_mpm node.

  7. Optionally, connect influence nodes such as wind_influence or turbulence_influence into the influences input of the simulate_mpm node.

  8. To visualize the flow of the gel particles, connect the granular_points output of the simulate_mpm node to a graph output or terminal node. Play through the simulation and adjust settings as desired.

    • The yield_stress property on the source_mpm_gel node controls the overall behavior — the larger the value, the more the gel will clump together and resist yielding under shear force.
  9. To generate a mesh for rendering, it's best to cache the particles because rendering typically takes longer than the simulation and can be easily resumed (unlike the simulation).

    • Before caching, you can use erase_component_properties to remove point properties that are no longer needed and reduce the size of the cache files. You can use a watchpoint to list the properties of the gel points, but note that the granular_points output is an array so you need to get the gel points object from the array first.
    • Connect the output to a file_cache node, and connect its output to a graph output or terminal node.
    • For the meshing, use points_to_volume followed by volume_to_mesh. To tweak the mesh output, you can use set_geo_property to adjust point_size before points_to_volume, as well as use smooth_voxel_property to adjust volume properties afterwards — the details depend on what you are trying to simulate and how you want it to look.