Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Let's open the AtomsRobotman.hip file and duplicate the robot headhairs, duplicate the robot head creating multiple expressionthen edit the mesh to create multiple blend shapes target.

Then select the the meshes and the original head hairs and create a blend shape deformer.

Image RemovedImage Added


Exporting meshes

You need to export the blend shapes targettargets. If you use the variation builder, Atoms automatically exports the blend shapes data inside the meshes.

If you want to export them manually, open the atoms mesh exporter from the atoms menu: Atoms > Export > Mesh exporter

Set the output path, then turn on the "export skin weight option". Inside the skeleton path filedfile, pick the atomsRobotman.atomsskel from the AtomsMaya/data folder. Then select the robot man Hips joint and press the refresh button. Finally, turn on the "export blend shapes" option, select the mesh you want to export and press the "Export" button. This tool automatically writes points, normals, id and name of each target inside the mesh file.


Note

If you want to inspect the mesh content, open the file as a MapMetadata in python or c++, the . The blend shapes data are stored inside the "blendShapes" key.

Code Block
languagepy
import AtomsCore
mesh_file = "robot1blendshape_head_blendhair.geos"
ark = AtomsCore.Archive()
if ark.readFromFile(mesh_file):
    mesh = AtomsCore.MapMetadata()
    mesh.deserialise(ark)
    for geo in mesh.keys(): #iterate over each geo
        targets_data = mesh[geo]["blendShapes"]
        for i in range(len(targets_data)):
            target = targets_data[i]
            points = target["P"].value()
            normals = target["N"].value()
            id = target["id"].value()
            name = target["name"].value()
            print id, name




Image RemovedImage Added


Importing meshes

Create a new scene , and now import the robot man variation table. From the atoms menu execute Atoms > Variations > Import variation jsonJSON. Set Select the robotvariations.json file form from the AtomsHoudini\1618.05.671521\data\variations folder. This will load the man variation table into the scene the robot variation table.

Open the variation manager from the atoms menu: Atoms > Variations > Agents Variation Manager. Select the atomsRobot man from the column on the left and then go inside the Geometry tab. Replace the robot1hair01_head GEO path with the mesh you just exported. Now press ctrl+s or from the widget menu execute File > Register to Atoms to save the changes.


Image RemovedImage Added


Setting up variations
  • Create and an agent group node.
  • Add a grid layout and set the grid size to 5,0,5
  • Add a state machine module
  • Add a variation module and set the variationName attriute attribute to "Robot1casual_1"
  • Change the display type to variations
  • Rewind the scene

Image RemovedImage Added


Setting targets weight

The targets target weights are controlled by some double metadatasmetadata. The metadata name should have the following follow this convention:

AgentTypeName_VariationGeometryName_TargetIndex

In our case, the following metadata names are valid:

  • atomsRobotman_robot1hair01_headGEO_0atomsRobot
  • man_robot1hair01_headGEO_1
  • atomsRobot_robot1_head_2
  • atomsRobot_robot1_head_3

The target index is the order used by the maya blend shapes deformHoudini blend shape deformer order, so the 0 index 0 is the first input of the the formerblend shape, the 1 index 1 is the second one, and so on.

We can add and control these metadatas metadata using the AddMetadata module

  • Add an "AddMetadata" behaviour module
  • Set the name attribute to atomsRobotman_robot1hair01_headGEO_0
  • Set the type attribute to double
  • Set the double value attribute to 1.0
  • Rewind the scene

Try to add more addMetadata modules on the same agent group to control the atomsRobotman_robot1hair01_headGEO_1, atomsRobot_robot1_head_2 etc.. metadatasmetadata. You can also add keyframes on the doubleValue attribute to animate the blend shapes.

Image Added


Blend shape manager

You can handle blend shapes more easily with the blend shape manager module.

Remove all your addMetadata modules and add a "blendShapeManager" module to your agent group. In blendShapeManager attributes, click on the "Manage Blend Shapes" button, the UI on the right will be prompted.

From there, you will select the blend shapes .Image Removedyou want to add to the agent group. 

You can select/deselect blend shapes by double-clicking or using the button on the top of the list. 
Please be careful when clicking the "Expand" buttons, as it could take some time to populate the entire tree if you have a lot of variation geometries.

Click on the tick button on the bottom right corner. The blend shapes will now be visible under the blendShapeManager attributes tab, where you will animate them.

Note

Please note the blend shape manager UI will look empty if either:

  • the agent group does not contain any agent.
  • There's no variation available for the agent types contained by this agent group.



Image Added

Image Added


Adding animation

To add more complex animation or animation clycles cycles to the blend shapes, we can use the blendShapesAnim module. Before start to you can use this moduel module, you should have to export some animation curves from your setup scene. So open Open the atomsRobot man scene were where you created the blendshapes . Add and add some keyframes on the targets weight of the maya blend shape deformer's target weights.



Image RemovedImage Added


Now select the robot head hairs and open the blend shapes anim exporter from the atoms menu: Atoms > Export > Blend shapes anim exporter.

Set the output path and the frame range, select the head mesh and press the run button.

Image RemovedImage Added

Go back to the atoms scene and remove all the addMetadata nodesblendShapeManager module.

Add a blendShapesAnim behaviour module . Inside the anim data attribute press the Add button to add a new row.

Fill the row using atomsRobot as agent type, robot1_head as geo name, triggerAnim as metadata name, the path of the animation you exported as anim file and in the last column add loop if you want play the animation in loop.

Now the animation is activated by the triggerAnim metadata. So let's add this metadata using ad addMetadata module. and click on the "Manage Animations" button under the blendShapeAnim tab.

Click on the "+" button for adding a new animation, select the "hair01_GEO" in the Geo field and set the path to the animation file we just exported. Leave the property to loop (no property will play the blend shapes animation once).
You can, of course add multiple animations, but we will stick with one for this example.

Click on the tick button, and you will see this data being converted inside the "animData" parameter.

Press play, and you will see the blendshapes being animated in a loop inside the viewport.

Click on the "Manage Animations" button again and activate the "Enable Trigger Metadata" checkbox. Type "triggerAnim" as the name for your metadata.

Create an addMetadata module and place it before the blendShapesAnim module. Set the name attribute to triggerAnim, Change change the type to double and set the doubleValue to 1.0.

Now rewind the scene and press play.

You can add multiple rows to control multiple animations at the same time.

Image Removed

The animation is controlled by the triggerAnim metadata. So to creates a more complex setup we can The result will be exactly as before.


Image Added

Let's use an area trigger to drive this the metadata.

First, let's change the agent state to 1 inside the state machine to make them walk. Inside the addMetadata module change the double value to 0 because (the area trigger module will drives this value). Now create a an areaTrigger module and module and create a plane in the scene. Connect the plane to the areaTrigger module (remember to connect also the translation/rotation/scale) and set the metadata name attribute to triggerAnim, the double value to 1.0, the blend in and out to 10 and the random delay in and out to 5. Move the area trigger before above the blendShapeAnim module. Rewind the scene and press play.

Image RemovedImage Added