Houdini 21.0 Character KineFX

Creating custom rig functionality

On this page

The APEX Autorig Component SOP provides different ways to create your own custom tools, including the use of rig component scripts, a built-in code interface that accepts APEX Script snippets, and the ability to merge rig functionality from a graph into an existing rig.

Create custom functionality using APEX Script

The APEX Autorig Component SOP provides an interface for writing APEX Script code. On the APEX Autorig Component SOP, set Component Source to Snippet. You can enter APEX Script code into the Snippet parameter and save the script functionality as its own rig component.

Merge graph functionality into an existing rig

The fuse graph operation in the APEX Autorig Component SOP allows you to merge a graph into an existing rig. In this way, you can start with a character rig, extract the part of the rig you want to update, edit the functionality in a graph, and merge the updates back into the rig. This method provides a modular workflow for making changes to your rig.

Workflow for merging a graph into an existing rig

The fuse graph operation adds and connects the new nodes introduced in the APEX Graph SOP. It doesn’t rewire or remove nodes.

Note

To use the fuse graph functionality, it is not recommended to put new nodes into a subnet in your graph (in the APEX Graph SOP). If you rename the subnet later on, your graph will no longer work. Fuse graph also cannot take existing nodes from a graph and add it into a new subnet. It can, however, insert an entirely new subnet into an existing rig.

We demonstrate the use of the fuse graph operation with the following examples:

  • Adding a control shape to a rig.

  • Adding custom IK functionality to a rig.

Add a control shape

In this example, we add a control shape to a character’s spine joint:

  1. We start with a character’s skeleton and add it to a character folder structure using the APEX Pack Character SOP.

  2. Create an FK rig graph - on the APEX Autorig Component SOP, fk, set Component Source to FK Transform. See rigging a simple geometry and rigging a character for more information about the FK transform component.

    The FK rig graph can be seen in the APEX network view. The green nodes are the TransformObject nodes that represent the skeleton joints:

    FK rig graph
  3. The APEX Graph SOP can take in a character folder structure and automatically find the rig graph. You can also tell the APEX Graph SOP to find a specific rig in the character folder structure by setting the Graph Path parameter. Once the APEX Graph SOP has a starting graph, you can edit the graph manually in the APEX network view.

    In this example, the APEX Graph SOP contains a copy of the entire FK rig graph as a starting point. From here, you have the option of simplifying the graph to make it easier to work with in the APEX network view.

  4. Select the APEX Graph SOP and go to the APEX network view to manually update the graph. Add a control shape to the spine joint by connecting a new rig::ControlShape node to one of the spine’s TransformObject nodes:

    Add a spine control shape
  5. Select the rig::ControlShape node and press P over the APEX network view to open the node parameter window. Set color to (1,0,0) and shapetype to box_wires.

  6. In the animate state, you can see a visual representation of the rig in the viewport as you update the graph in the APEX network view. To enter the animate state, select the APEX Graph SOP, turn on its display flag, and click Animate on the left toolbar:

    Original rig (left), added spine control shape (right)
  7. Merge the graph from the APEX Graph SOP to the original FK rig graph - on the second APEX Autorig Component SOP, merge_graph, set Component Source to Fuse Graph. The fuse graph operation, finds the new node and connects it into the original graph.

    In the APEX network view on the APEX Autorig Component SOP, merge_graph, the rig::ControlShape node is added to the FK rig graph from the first APEX Autorig Component SOP, fk. The new node is in green:

    Updated FK rig graph with the new node

Simplify the graph

If your change only affects certain parts of the rig, you can simplify the graph by removing the TransformObject nodes that aren’t relevant to your change:

  1. As a starting point, the APEX Graph SOP contains the FK rig graph from the previous example. Remove all the TransformObject nodes except the spine_01 node:

    See graphs for deforming geometry for more information about the skel::SetPointTransforms node.

  2. We had removed spine_01's parent in the process, so we need to place the joint back at its proper position on the skeleton:

    • On the APEX Graph SOP, in the Rigging Scripts section, click Update Rest Transforms From Skeleton.

    • Enter the animate state on the APEX Graph SOP to see the TransformObject node on the spine joint:

  3. Add a control shape to the spine joint by connected a new rig::ControlShape node to the spine’s TransformObject node.

    • Select the rig::ControlShape node.

    • In the node parameter window, set color to (1,0,0) and shapetype to box_wires.

    The added control shape can be seen in the animate state:

  4. The fuse graph operation in the APEX Autorig Component, merge_graph, finds the new node, rig::ControlShape, and connects it into the original FK rig graph at the spine_01 TransformObject node.

Add custom IK functionality

The fuse graph operation allows you to create flexible tools that can be applied to different parts of a character’s rig. In this example, we manually construct a graph that adds IK functionality to a character’s leg. We then mirror and transfer the IK functionality to the character’s arms:

  1. We create the following IK functionality on the character’s leg by manually building a graph in the APEX Graph SOP. Select the APEX Graph SOP, turn on its display flag, and enter the animate state:

  2. On the APEX Autorig Component SOP, merge_graph, set Component Source to Fuse Graph. The fuse graph operation adds the new IK functionality to the original FK rig graph.

  3. Select the APEX Autorig Component SOP, merge_graph, turn on its display flag, and enter the animate state.

  4. Set the IK functionality to be mirrored on both sides of the rig. On our rig, the joints are named <joint>_l and <joint>_r, so change the From and To parameters to *_l and *_r. The Mirror parameter is already turned on, so mirroring is performed by default once the correct joint name mappings are set:

    IK functionality mirrored on both legs
  5. We can now transfer the IK functionality to other joint chains like the arms. Click beside Mapping and add three mappings, one for each of the root, mid, and tip joints in an IK chain. Mappings are performed between TransformObject nodes, which represent the skeleton joints.

  6. For each joint to map:

    • Click the icon beside the From parameter. This is the joint that has the existing functionality.

    • Select the joint in the viewport and press Enter. This populates the From parameter with the joint name.

      Note

      Select the joint, not the control that’s on the joint.

    • Click the icon beside the To parameter. This is the joint you want to put the functionality on.

    • Select the joint in the viewport and press Enter. This populates the To parameter with the joint name.

    In our example, the three mappings are:

    • From = thigh_l, To = upperarm_l

    • From = calf_l, To = lowerarm_l

    • From = foot_l, To = hand_l

  7. The IK functionality is placed on the arms:

Save and reuse rig functionality

You can save your custom rig functionality as its own rig component, then reuse it like you would with any of the pre-built components:

  1. On the APEX Autorig Component SOP, go to the Save tab.

  2. Specify a name for the component in the Component Name parameter. For example, if you set the namespace field to test, the name field to hello, and version to 2.0, your component will be named test::hello::2.0.

  3. Click Save to Disk. The component is stored in the location specified in the Component Output File parameter.

  4. Click the icon beside the Component Source parameter to update your library of components. Your new component will appear in the Component Source drop-down, and you can use it like any other component.

  5. Once you select your new component from the Component Source drop-down, you can edit its source as an APEX Script snippet. Click beside Component Source, which decompiles the component into the Snippet parameter where you can make additional changes to the component.

    Note

    For components created using the Fuse Graph operation, go to the Settings ▸ Header section, and set Template to Template.

KineFX

Overview

Preparing character elements

Rigging with APEX graphs

Building rig graphs with APEX Script

Rigging with rig components

Animating in the viewport

SOP-based animation

Deformation

Animation retargeting

Pre-H20

Panes

Appendix