Set up a granular simulation

Granular simulations include scenarios where grains of solid material can flow. In addition to sand and snow, the granular framework is also used for gel and rubber.

MPM sand


Instead of building an MPM simulation graph from scratch, check out the sample graphs available in the Bifrost Browser. If one of them is similar to the effect you want to achieve, you can import it and then adapt it to your needs or simply study how it works.

For sand and snow, another alternative is to add a basic_mpm_sand_graph or basic_mpm_snow_graph node and then explode it to get a graph with a few basic connections and setting already made.

To set up a granular simulation:

  1. Prepare the meshes to use as emitters for the granular materials, as well as the meshes to use as objects to collide with (including receptacles to hold the materials if required). 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, composed of 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 emitter meshes from the scene, you probably want to hide them.
  2. Add one of the following nodes to the graph, set its parameters, and connect the output of an emitter mesh into its geometry input.

    • source_mpm_sand
    • source_mpm_snow
    • source_mpm_gel
    • source_mpm_rubber

    Note that by default, the source node is set to create a one-time emission on frame 1, which is appropriate for something like a snow bank or sandy beach. If you want a continuous emission instead, turn off use_end_frame on the source node.

  3. Repeat the previous step for additional emitters. You can combine different materials in the same simulation.

    • Use separate source 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. Alternatively, you can merge the meshes into a single mesh beforehand.
    • You can combine different materials, for example both sand and snow, in the same simulation.
  4. Connect the outputs from the source nodes into the sources port of a simulate_mpm node.

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

  6. Connect the meshes that you want to use as obstacles into collider nodes. As with sources, you can have multiple geometries connected to a single collider node, and multiple colliders nodes connected to the simulate_mpm node. For example to make footprints, you need a collider for the ground that prevents the snow or sand from falling away, as well as colliders for the people walking.

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

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

  9. At this point, you can preview the flow of particles by toggling the P (proxy) or D (diagnostic) flag on the simulate_mpm node and playing through from the first frame. Adjust the simulation parameters as desired.


    If you experience problems with collisions (such as particles leaking through colliders, or offset collisions), try setting the method on the collider node to Volume. This is more accurate but takes longer to compute. You can also try turning on lag_colliders on the mpm_solver_settings node.

  10. For the final rendering, it's best to cache the particles to files on disk. Rendering typically takes longer than the simulation and can be easily resumed (unlike the simulation). There are many ways to cache, but here are some suggestions:

    • Optionally before caching, you can reduce the size of the cache files by removing point properties that are not needed for rendering. Since the granular_particles output of simulate_mpm is an array (one points object for each material type), first connect it into split_points_by_material. Connect each of the outputs that you want (such as sand_particles) into an erase_component_properties node, and then connect that into an output node at the top level of the graph or a terminal node. Add a watchpoint on those final connections to see the list of properties, and enter any properties that you don't want to cache into the properties parameter of erase_component_properties.
    • For the caching itself, connect the output of erase_component_properties (or the granular_particles output of simulate_mpm if you are not using erase_component_properties) to a file_cache node, and connect its output to an output node at the top level of the graph or a terminal node. Enter a file name and location, set the file_cache node's mode to Write Mode, and play through the full simulation from the start frame. When you are finished, don't forget to set the file_cache node's mode to Read Mode.
  11. In some situations, especially for gel or rubber simulations, you may want to mesh the output.

    • 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.
    • You can also 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.

Adjusting sand and snow

Here are some tips for emulating different sand and snow conditions with the parameters on the source node:

Adjusting gel

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.