Caching agents to USD

In Atoms you can save your simulation on disk using USD, then it is possible to reuse these caches with the "usdCacheReader" behaviour module. 

With the USD cache reader and the agents layout tool you can edit and tweak your cache.


Exporting a cache

You can open the usd cache exporter GUI using the shelf button or via the Atoms Menu: Atoms > Export > Usd Exporter

  • Create an agent group

  • Add a grid layout behaviour module and set the size attribute to (10,0,10)

  • Add a state machine behaviour module and set the state attribute to 1

  • Create some other agent groups and move them

  • Open the cache exporter form the Atoms menu: Atoms > Export > USD Exporter

  • Select the agent groups you have created from the list, then choose a path where your cache will be saved.

  • Finally, select your start and end frame.

  • Click on the "Export" button.




Importing a cache

You can import a cache in a scene using the usdCacheReader behaviour module

  • Create an agent group.

  • Add a usdCacheReader behaviour module.

  • in the cachePath attribute of the cache reader module pick the USD cache file.

  • Rewind the scene and atoms will load the cache. It also automatically load all the agent types that are missing from your scene.

  • You can create multiple agent group to load different caches or the same cache multiple times. You can also move then around and rotate them.

When using a USD cache, the data is loaded by the UsdStageCache which will keep the stage in memory as long as you have the scene open. If you modify a USD file that is already loaded by a UsdCacheReader module, you need to reopen the scene to get the updated version.


Editing a cache

When a cache is loaded in your scene, you can still edit it to change your layout or simulation.

Apply a new height field

Works only with USD caches generated with Atoms Crowd.

Even if you exported the cache from some agent groups on a height field you can apply a new height field to your cache

  • Create a new height field

  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • In the cache reader height field attribute select the new height field

  • Rewind the scene and press play




Move agents
  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • To move agents, you can use the transitionOffset attribute or you can use the Agents Layout Tool

  • Select the agent group and activate the agents layout tool from the Atoms menu: Atoms → Tools → Agents Layout Tool

  • Press Q to switch to the selection mode or press

    or RMB on the viewport and choose Select mode

  • Select the agents you want to move

  • Press W to switch to the move mode or press 

    or RMB on the viewport and choose Move mode

  • Use the manipulator to move the agents where you want, in Maya 2016 the manipulator doesn't work so just press the LMB on the location where you want to move the agents

  • Rewind the scene and press play




Rotate agents
  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • To rotate agents, you can use the rotationOffset attribute, or you can use the Agents Layout Tool

  • Select the agent group and activate the agents layout tool from the Atoms menu: Atoms → Tools → Agents Layout Tool

  • Press Q to switch to the selection mode or press

    or RMB on the viewport and choose Select mode

  • Select the agents you want rotate

  • Press E to switch to the rotate mode or press 

    or RMB on the viewport and choose Rotate mode

  • Press the LMB and move the mouse on the left or on the right to rotate the agents

  • Rewind the scene and press play




Delete agents
  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • To delete agents, you can use the filterAgent attribute (set value of 1 to remove an agent) or you can use the Agents Layout Tool

  • Select the agent group and activate the agents layout tool from the Atoms menu: Atoms → Tools → Agents Layout Tool

  • Press Q to switch to the selection mode or press

    or RMB on the viewport and choose Select mode

  • Select the agents you want to delete

  • And from the UI press the "Delete Selected Agents" button or RMB and "Delete agents" from the menu

  • Rewind the scene and press play




Change agents speed

You can also change the agent speed changing the frameRate attribute. This attribute is a multiplier on the input time.



  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • To change the speed of some agents, open the override agent dialog 

    next to frameRate attribute

  • Select the agents you want to modify form the list or use the Agents Layout Tool to select the agents (the selection inside the override dialog changes automatically)

  • Set a value of 0.5 in the value’s field and then press "Set Value" button

  • Rewind the scene and press play








Offsetframe

You can offset the cache frame for each agent, so an agent can start playing at frame 10 instead of frame 0.

  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • To offset the start frame of some agents open the override agent dialog 

    next to frameOffset attribute

  • Select the agents you want to modify form the list or use the Agents Layout Tool to select the agents(the selection inside the override dialog changes automatically)

  • Set a value of 10 in the value’s field and then press "Set Value" button

  • Rewind the scene and press play




Duplicate agents

You can clone agents inside a cache



  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • Select the agent group and activate the agents layout tool from the Atoms menu: Atoms → Tools → Agents Layout Tool

  • Press Q to switch to the selection mode or press

    or RMB on the viewport and choose Select mode

  • Select the agents you want to duplicate

  • Press the button "Duplicate selected agents" or press RMB and choose "Duplicate agents"

  • Atoms duplicates the selected agents with an offset

  • Press W to switch to move mode or press 

    or RMB on the viewport and choose Move mode and move the new agents where you want

  • Rewind the scene and press play






Resim agents

The cache reader module gives you the possibility to simulate any agent again, so you can apply direction modules and so on.

  • Create an agent group and import your cache using the UsdCacheReader behaviour module

  • Select the agent group and activate the agents layout tool from the Atoms menu: Atoms → Tools → Agents Layout Tool

  • Press Q to switch to the selection mode or press

    or RMB on the viewport and choose Select mode

  • Select some agents

  • Open the override agent dialog next to directionFromCache attribute

  • Set a value of 0

  • Create a curve near the selected agents

  • Add a follow curve module

  • Attach the curve to the follow curve module

  • Rewind the scene and press play, the selected agents will follow the curve








Copyright © 2017, Toolchefs LTD.