Create an ML Deformer

Important: When you train the ML Deformer, you may be prompted to download and install external Python modules. By default, the install path of the extra modules is <MAYA_APP_DIR>/mlDeformer/<ml_deformer_version>/Lib/site-packages. If you need to download these modules manually and/or install them to a custom location, see Install Python libraries to train the ML Deformer.

This topic gives an example of how the ML Deformer simulates deformation animation from one deformed object on another object, using the Deformer Attributes widget (Deformer stack) to create an ML Deformer.

This method of creating an ML Deformer is useful if you have a rig already set up as it avoids the steps for transferring the deformation target mesh. See Create an ML Deformer using separate Target geometry for a different workflow where you can specify which animation controls you want to use during the set up.

Tip: You can test and experiment with ML Deformer sample files in the Content Browser (Windows > Content Browser > Examples > Animation > MLDeformer).

Sample ML Deformer animation in the Content Browser

The following example shows the workflow of creating an ML Deformer with the Deformer widget

  1. In this example, the Target mesh is a sphere with a Sine deformer attached to it that we will use to represent a complex rig.

    A sphere with a Sine deformer

  2. Select the sphere and choose Deform > ML Deformer in the Animation (F4), Rigging (F3), or Modeling (F2) menu set to add an ML Deformer to it.
  3. With the sphere still selected, go to the pSphereShape1 Attribute Editor tab. Using the Deformer Attributes widget Up arrow , select the ML Deformer in the Deformation stack and advance it so that it is above the Sine deformer. Anything ranked above the ML Deformer in the Deformation stack is not approximated.

    Use the Up arrow in the Deformation stack to change the deformer ranking

  4. Return to the ML Deformer tab in the Attribute Editor. Right-click the Target Geometry column and select Create Target for Deformers Post ML Deformer.
    The sphere is added to the Target Geometry. That sets up the Target Shape, which is hidden by default. You can unhide it in the Outliner (Shift + H/Ctrl + H) to tweak the attributes. This way you can see that it is working on the Target deformer but not the Original shape.

    Showing the original Sine deformation

  5. Select the sphere and switch to the Attribute Editor Control Collector tab and expand the Add Controls table. Right-click and choose either Add Selected or Add All to choose which attributes you want to control the deformation in the Attribute Editor Add Controls list. (See the ML Deformer Control Collector attributes topic).
    Note: You can also click the Add () button at the top right of the list.

    Adding Controls

    The attributes are added to the Connected Controls list, located below the Add Controls list.

  6. Set the Connected Controls list Min and Max values for the deformation training.
    Tip: You may need to stretch the Attribute Editor window to view the Min and Max columns.
  7. Return to the Attribute Editor ML Deformer tab, and click Export Training Data to open the ML Deformer Export Training Data window window, and set the following:
    • Training Data Location: Browse to where you want to save your training data and create a folder for it.
    • Export Start/End Frame: Set the range of frames to capture from the Target geometry deformation.
    • Training Data Name: Choose a name for the data.
    • Click Export. The animation is exported as training data. See ML Deformer Export Training Data window for a detailed explanation of each setting in this window.
  8. When the export process is complete, in the Attribute Editor ML Deformer tab, click Train the Model… to open the Training ML Deformer window to use the data you captured to train the deformation.
  9. The Training Data Location field shows where the training data and model are found.

    (You can also right-click the ML Model cell in the ML Deformer Attributes list and select Train Model… from the contextual menu.)

    See ML Deformer Training Settings for a detailed explanation of each setting in this window.

  10. In the Training ML Deformer window that appears, set the following:
    • Output ML Model Name: Choose a name for your trained model.
    • Activate Preload Data: to speed up the training (at the cost of memory usage).

      ML Deformer Training window

  11. Click Train. Two Python windows appear. You can track the progress of this and any other ML Training in the ML Deformer Job Monitor . When you see the message [ML Deformer] Training complete in the Python window, the training is finished.
    Important: When you click Train, you may be prompted to download and install external Python modules. By default, the install path of the extra modules is <MAYA_APP_DIR>/mlDeformer/<ml_deformer_version>/Lib/site-packages. If you need to download these modules manually and/or install them to a custom location, see Install Python libraries to train the ML Deformer.
  12. Turn on Enabled in the ML Deformer list so that the ML Deformer applies the learned deformations.

    Target Morph toggles between the Target and ML Deformation

    Like other deformers, you can adjust the Envelope setting to reduce the effect of the ML Deformation.