unreal.MLDeformerMorphModel

class unreal.MLDeformerMorphModel(outer: Object | None = None, name: Name | str = 'None')

Bases: MLDeformerGeomCacheModel

MLDeformer Morph Model

C++ Source:

  • Plugin: MLDeformerFramework

  • Module: MLDeformerFramework

  • File: MLDeformerMorphModel.h

Editor Properties: (see get_editor_property/set_editor_property)

  • alignment_transform (Transform): [Read-Write] The transform that aligns the Geometry Cache to the SkeletalMesh. This will mostly apply some scale and a rotation, but no translation.

  • anim_sequence (AnimSequence): [Read-Write] The animation sequence to apply to the base mesh. This has to match the animation of the target mesh’s geometry cache. Internally we force the Interpolation property for this motion to be “Step”.

  • bone_include_list (Array[BoneReference]): [Read-Write] The bones to include during training. When none are provided, all bones of the Skeleton will be included.

  • curve_include_list (Array[MLDeformerCurveReference]): [Read-Write] The curves to include during training. When none are provided, all curves of the Skeleton will be included.

  • delta_cutoff_length (float): [Read-Write] Sometimes there can be some vertices that cause some issues that cause deltas to be very long. We can ignore these deltas by setting a cutoff value. Deltas that are longer than the cutoff value (in units), will be ignored and set to zero length.

  • geometry_cache (GeometryCache): [Read-Write] The geometry cache that represents the target deformations.

  • include_bones (bool): [Read-Write] Specifies whether bone transformations should be included as inputs during the training process.

  • include_curves (bool): [Read-Write] Specifies whether curve values (a float per curve) should be included as inputs during the training process.

  • include_normals (bool): [Read-Write] Include vertex normals in the morph targets? The advantage of this can be that it is higher performance than recomputing the normals. The disadvantage is it can result in lower quality and uses more memory for the stored morph targets.

  • invert_mask_channel (bool): [Read-Write] Enable this if you want to invert the mask channel values. For example if you painted the neck seam vertices in red, and you wish the vertices that got painted to NOT move, you have to invert the mask. On default you paint areas where the deformer should be active. If you enable the invert option, you paint areas where the deformer will not be active.

  • mask_channel (MLDeformerMaskChannel): [Read-Write] The channel data that represents the delta mask multipliers. You can use this feather out influence of the ML Deformer in specific areas, such as neck line seams, where the head mesh connects with the body. The painted vertex color values will be like a weight multiplier on the ML deformer deltas applied to that vertex. You can invert the mask as well.

  • max_training_frames (int32): [Read-Write] The maximum numer of training frames (samples) to train on. Use this to train on a sub-section of your full training data.

  • morph_compression_level (float): [Read-Write] The morph target compression level. Higher values result in larger compression, but could result in visual artifacts. Most of the times this is a value between 20 and 200.

  • morph_delta_zero_threshold (float): [Read-Write] Morph target delta values that are smaller than or equal to this threshold will be zeroed out. This essentially removes small deltas from morph targets, which will lower the memory usage at runtime, however when set too high it can also introduce visual artifacts. A value of 0 will result in the highest quality morph targets, at the cost of higher runtime memory usage.

  • quality_levels (Array[MLDeformerMorphModelQualityLevel]): [Read-Write] The list of quality levels, where the first item represents the highest quality and the last element the lowest quality level. The number in each quality level represents the number of active morph targets for that quality level. These numbers will be clamped internally to be within valid ranges in case they go beyond the amount of morphs that exist.

  • skeletal_mesh (SkeletalMesh): [Read-Write] The skeletal mesh that represents the linear skinned mesh.

set_morph_target_delta_floats(deltas) None

Set the per vertex deltas, as a set of floats. Each vertex delta must have 3 floats. These deltas are used to generate compressed morph targets internally. You typically call this method from inside the python training script once your morph target deltas have been generated there. Concatenate all deltas into one buffer, so like this [morphdeltas_target0, morphdeltas_target1, …, morphdeltas_targetN]. The vertex ordering should be: [(x, y, z), (x, y, z), (x, y, z)]. This is the same as SetMorphTargetDeltas, except that this takes an array of floats instead of vectors.

Parameters:

deltas (Array[float]) – The array of floats that contains the deltas. The number of items in the array must be equal to (NumMorphs * NumBaseMeshVerts * 3).

set_morph_target_deltas(deltas) None

Set the morph target model deltas as an array of 3D vectors. These deltas are used to generate compressed morph targets internally. You typically call this method from inside the python training script once your morph target deltas have been generated there. Concatenate all deltas into one buffer, so like this [morphdeltas_target0, morphdeltas_target1, …, morphdeltas_targetN]. This is the same as SetMorphTargetDeltaFloats, except that it takes vectors instead of floats.

Parameters:

deltas (Array[Vector3f]) – The array of 3D vectors that contains the vertex deltas. The number of items in the array must be equal to (NumMorphs * NumBaseMeshVerts).

set_morph_targets_error_order(morph_target_order, error_values) None

Set the order of importance during LOD, for the morph targets. Basically this specifies the sorted order of the morph targets, based on the error they introduce when disabling them.

Parameters:
  • morph_target_order (Array[int32]) – The array of morph target indices, starting with the most important morph target, and ending with the least important morph target’s index.

  • error_values (Array[float]) – The error value for each morph target (not sorted), so index 0 contains the error value of the first morph target, which isn’t necesarrily the one with highest error.

set_morph_targets_max_weights(max_weights) None

Set the maximum weights for each morph target when we pass the training inputs into the trained neural network. After training we run the inputs through the trained network, and get the weights for each morph target. The array passed to this function must be the maximum of the absolute weight value over all training samples for each specific morph. We use this to scale the morph target deltas to get an estimate of the maximum length they will ever have, which we can in turn use to estimate how important a given morph target is. Keep in mind that these are the maximum of the absolute weights. As weights can be negative, we first take the absolute value of them. Training python scripts mostly will call this function to set the values.

Parameters:

max_weights (Array[float]) – The maximum of the absolute weight values.