Houdini 20.0 Nodes Geometry nodes

Muscle Flex geometry node

Activates and animates the contraction and relaxation of input solid muscle geometry.

On this page
Since 19.0

This node sets up and animates the muscletension point attribute on input solid muscle geometry which drives the flexing action of your muscles during their simulation.

The muscletension attribute is used by the muscle solver to apply anisotropic scaling or squeeze to the incoming tetrahedral meshes. This muscle scaling is applied along the muscle fiber direction defined by the materialW vector point attribute which comes from the Fiber Groom SOP node.

The amount muscles flex or the strength of their contraction during the squeeze is determined by the fiberstiffness attribute which comes from the Fiber Strength parameter on the Muscles Properties SOP node. muscletension functions a lot like a multiplier of fiberstiffness. When a muscle contracts, a volume preservation force also comes into play causing the non-tendonus regions of the muscle to bulge. This volume scale force is generated by the fibervolumescale attribute which comes from the Fiber Volume Scale parameter on the Muscles Properties SOP node.

Muscle flex & volume preservation
Example: Muscles with all muscle flex guides visible

With this node, you can perform three main muscle set-up tasks:

  • Link your muscle geometry (muscle_id attribute) to the muscle tension lines (autoflex_id attribute) that drive their automatic flexion timing.

  • Adjust the activation ratio between muscle tension line length (restlength and length attributes) and what is considered a fully flexed state for the muscles (muscletension attribute). This sets the threshold for what is considered flexed or not.

  • Animate the muscletension attribute which is then used by the muscle solver to help determine when muscles try to contract and relax during their shot animation. This contraction/relaxation can be driven automatically by the muscle tension lines alone or in combination with keyframes on the Muscle Flex parameters. You can tell the solver when to activate the muscles and by how much by keyframing those parameter values.

How to

To...Do this

Connect the necessary inputs to the Muscle Flex SOP

  1. In the Network Editor, create a Muscle Flex SOP node.

  2. Connect your solid muscle geometry (for example, like the output of the Muscle Constraint Properties Vellum SOP node) to input 1 on the Muscle Flex SOP node.

  3. Connect your prerolled animated bone geometry to input 2 on the Muscle Flex SOP node.

  4. (Optional) Connect your Muscle Tension Lines SOP node to input 3 on the Muscle Flex SOP node.

Warning

If you do not provide muscle tension lines on the Muscle Flex SOP node’s input 3, then you have to keyframe your muscle’s muscletension or else your muscles will not contract.

Build the parameters for the Muscle Flex SOP

  1. In the Network Editor, select the Muscle Flex SOP node.

  2. In the Parameter Editor, select the Muscle Flex tab.

  3. In the Muscle Flex tab, click Detect New.

    All the muscles connected to input 1 on the Muscle Flex SOP node are automatically detected and one Muscle ID parameter (flex control) per muscle_id appears in the Muscle Flex tab.

    Example: Building the Muscle ID parameters in the Muscle Flex tab and the and Activation Links parameters in the Activation Links tab.
  4. Select the Muscle Tension Lines tab and then click Detect New.

    All the tension lines on the Muscle Tension Lines SOP node connected to input 3 on the Muscle Flex SOP node are automatically detected and one Activation Ratio parameter per autoflex_id appears in the Muscle Tension Lines tab.

    Example: Building the Activation Ratio parameters in the Muscle Tension Lines tab.

Link muscles to muscle tension lines

  1. Make sure that you first follow the steps above for:

    • Connecting your Muscle Flex SOP node’s inputs.

    • Building the parameters for the Muscle Flex SOP node.

  2. In the Network Editor, select the Muscle Flex SOP node.

  3. Select the Activation Links tab.

  4. In the Activation Links tab, do one of the following for each of your muscles:

    • In the viewport state, LMB-click a muscle, press L, LMB-click the muscle tension line that you want to link to the selected muscle, and then press Enter. You can also use ⇧ Shift + LMB -click to select multiple muscles at a time during this step.

      The name of the muscle tension line you selected appears in the Activation Links parameter field next to its target muscle. If your model is symmetrical and Assign Links with Symmetry is turned on in the viewport state’s RMB menu, then the name of the muscle tension line also automatically appears in the Activation Links parameter field for the mirrored muscle on the other side of your character.

    • In the Activation Links tab, use the drop-down menus next to each listed muscle name to select the names of the muscle tension line that you want to drive each muscle.

      Example: Activation Links parameter fields

    The Activation Links parameters and this process of linking muscle_ids to autoflex_ids establishes the activation relationship between your muscle geometry and the muscle tension lines that drive their contraction.

Adjust the muscle flex activation threshold

  1. Make sure that you first follow the steps above for:

    • Connecting your Muscle Flex SOP node’s inputs.

    • Building the parameters for the Muscle Flex SOP node.

    • Linking your muscles to their corresponding muscle tension lines (you need to have provided a 3rd input on the Muscle Flex SOP node).

  2. Scrub through your shot’s animation with the timeline slider in the playback bar to see how your muscles are flexing.

  3. Select the Muscle Flex SOP node and then open the Parameter Editor.

  4. In the Muscle Tension Lines tab, adjust the Activation Ratio parameter values for each muscle until your muscles appear (via the Muscle Tension Visualization in the viewport state) to be contracting their fullest at the times you need them to be bulging the most.

    The Activation Ratio parameters determine the threshold for what is considered flexed or not. When you adjust these parameter values, you are changing the ratio between muscle tension line length (restlength and length attributes) and what is considered a fully flexed state for the muscles (muscletension attribute).

    For example, if is an Activation Ratio parameter is set to 0.75, then its target muscle is considered fully flexed when its muscle tension line’s length is 75% of the length of its restlength.

  5. If you are still not quite getting the muscle activation behavior you desire, try keyframing your muscle’s flex. For steps on how to do that, see the procedure below.

Adjust muscle contraction and animate muscle tension

  1. Make sure that you first follow the steps above for:

    • Connecting your Muscle Flex SOP node’s inputs.

    • Building the parameters for the Muscle Flex SOP node.

    • Linking your muscles to their corresponding muscle tension lines (if you provided a 3rd input on the Muscle Flex SOP node).

    • (Optional) Adjusting the muscle flex activation threshold.

  2. Select the Muscle Flex SOP node and then open the Parameter Editor.

  3. Select the Muscle Flex tab.

  4. In the Muscle Flex SOP viewport state, select one or ⇧ Shift -LMB multiple muscles and then press Enter to make them the current selection.

    Note

    Making muscles the current selection also isolates their keyframes. This means that only the keys for these muscles will now appear in the timeline and in the Animation Editor.

  5. Scrub the timeline slider in the playback bar to the frame at which you want to adjust and key the current muscle’s tension, and then do one of the following:

    • Press 1 to set the muscle’s muscletension to 1.

    • Press 0 to set the muscle’s muscletension to 0.

    • mouse_wheel to increase or decrease the muscle’s muscletension value.

  6. Press K to set a key on the muscle’s muscletension.

  7. Repeat steps 4-6 for each muscle you want to animate the muscletension for.

Important Note

You can only see the deformation results from your keyframes by playing back the muscle simulation from the Muscle Solver Vellum SOP node.

State

Muscle Flex state hotkeys

In the viewport, the Muscle Flex SOP state is inherently a selection state. Select one or multiple muscles and then press Enter to make them your current selection. Scrub the timeline slider in the playback bar to any frame and then perform an action on your current selection.

Hotkeys or Interaction

Action

Press 1

Set the muscle tension (Muscle Flex) for the currently selected muscle(s) to 1.

Press 0

Set the muscle tension (Muscle Flex) for the currently selected muscle(s) to 0.

MMB-scroll

Increase or decrease the muscle tension for the currently selected muscle(s).

Press K

Set a keyframe on the muscle tension at the current time for the selected muscle(s).

Muscle Flex state right-click menu
Viewport state right-click menu

Set Keyframe

Sets a key on the Muscle ID parameter (flex control) for the currently selected muscle. Also lists the K hotkey.

Set Flex to 0

Sets the Muscle ID parameter value for the currently selected muscle to 0. Also lists the 0 hotkey.

Set Flex to 1.0

Sets the Muscle ID parameter value for the currently selected muscle to 1.0. Lists the 1 hotkey.

Muscle Flex state visualizers

Visualization

Viewport State

Muscle selection

You can select your muscles directly in the viewport state. This is useful when animating your muscles' flex in the viewport state using hotkeys.

Muscle activation

You can view the activation of your muscles and their tension levels while playing back your character’s shot animation with the Display > Muscle Tension Visualizer parameter. The muscles change color to indicate their amounts of muscletension during the animation.

These values change automatically over time because of the muscle tension lines and the solve, but you can also change them and keyframe them manually with the parameters in the Muscle Flex tab.

Attributes

muscletension

point

Stores the variable muscle flex values over time as point transforms.

Parameters

Attribute

Specifies the name of the attribute that stores all the muscle flex settings.

Muscle Flex

This tab lists the Muscle Flex parameters.

The parameters found on this tab are generated automatically by detecting the muscle_id attributes on the incoming muscle geometry. A float parameter is created for each muscle_id found on the first input of the Muscle Flex SOP node. The parameter names are labeled identically to the muscle_id names for easy identification.

In the viewport, muscles change color to indicate their amount of tension or muscle flex. You can tell the muscles when to activate and when not to activate by keyframing the Muscle Flex parameter values.

When you bring muscles into a simulation, their contraction is driven by a combination of muscletension (Muscle Flex parameters) and a fiber scale force (fiberstiffness attribute from the Muscles Properties SOP node) that is applied to the tetrahedra. Muscles scale in the muscle fiber direction (materialW vector point attribute from the Fiber Groom SOP node).

You can control your muscles' flex animation in one of three ways:

  1. By assigning a muscle tension line to a Muscle Flex parameter using the Activation Links.

  2. By directly keyframing the individual Muscle Flex parameters in this tab.

  3. By using a combination of 1 and 2.

If your Muscle & Tissue set-up uses muscle tension lines, you don’t have to keyframe the muscletension per muscle (via the Muscle Flex parameters) over the entire course of your shot’s animation. The muscle tension lines will drive those changes in the muscletension values for you.

Even though the muscle tension lines automate a lot of the muscle contraction for you, you can still tweak the programmatic muscletension values they generate by adding some keyframes to the Muscle Flex parameters as needed.

If a muscle’s muscletension is controlled by both keyframe values and the muscle tension line that is driving it, the value that wins out is the stronger/higher value. For example, if the muscletension that is detected from the muscle tension line is 0.5 and the keyframed Muscle Flex value is 0.75, the keyframed value would win out. You will always get the maximum value.

Input

This node caches the muscle_id names found on the incoming muscle geometry (input 1) in order to preserve any animation and parameter settings.

These buttons allow you to update and/or reset this cache in the event that you add or remove muscles after their geometry node has already been connected to the Muscle Flex SOP node.

Detect New

Looks for any new muscle_ids found on the input muscle geometry and appends them to the parameter list.

Remove Unused

Removes any Muscle Flex parameters listed in this tab if their corresponding muscle_ids do not exist on the input muscle geometry.

Reset All

Resets all the current Muscle Flex and Activation Links parameters to their default values and rebuilds the internal cache list.

Warning

Clicking Reset All also deletes any existing Muscle Flex channel animation.

Muscle IDs

Lists the Muscle Flex parameters. The parameter names will adapt according to the incoming muscle geometry (input 1). Each parameter listed here is derived from the input muscle_ids with the same name.

A Muscle Flex value of 0 will cause a muscle to simulate as a relaxed softbody, and a value of 1.0 will maximize the muscle tension and cause a muscle to contract and stiffen.

Muscle Tension Lines

This tab lists the Activation Ratio parameters and it is only enabled when a Muscle Tension Lines SOP node is connected to this node’s third input (Input 3).

When a muscle tension line is linked to one or more muscles, a change in length is used to drive the muscletension attribute on the muscles. You can use keyframed muscle tension at the same time as muscle tension lines. The maximum of the two is applied to the resulting muscletension attribute.

In the Muscle Tension Lines tab > Activation Ratio section of the parameters, you can set the muscle activation threshold for any given line. A change in length that amounts to this ratio will map to a fully tensed muscle. For example, if the L_Bicep parameter is given a value of 0.75, and L_Bicep is linked to the L_Bicep muscle tension line, then when the L_Bicep muscle tension line reaches 75% of its rest_length, the muscletension for the L_Bicep muscle would be 1.0. If the value of the parameter is set to 2.0, when the muscle tension line reaches 200% of its rest_length, the muscletension for the L_Bicep muscle would also be 1.0.

Tension Line Timing

Evaluate at Frame

Specifies at what frame in the shot’s animation the muscle flex is activated.

Input

This node detects and caches a primitive attribute named autoflex_id found on the incoming muscle tensions lines (input 3).

These buttons allow you to update and/or reset this cache in the event that you add or remove any muscle tension lines after their Muscle Tension Lines SOP node has already been connected to the Muscle Flex SOP node.

Detect New

Looks for any new autoflex_ids found on the input Muscle Tension Lines SOP node and appends them to the parameter list.

Remove Unused

Removes any Activation Ratio parameters listed in this tab if their corresponding autoflex_ids do not exist on the input Muscle Tension Lines SOP node.

Reset All

Resets all the current Activation Ratio parameters to their default values and rebuilds the internal cache list.

Activation Ratio

The parameters found in this section are automatically generated by detecting the autoflex_ids attributes on the Muscle Tension Lines SOP node. A float parameter is created for each autoflex_id found on the third input (input 3) of the Muscle Flex SOP node. The parameter names are labeled identically to the autoflex_id names for easy identification.

The Activation Ratio parameter values indicate the length ratio at which maximum contraction should occur. The ratio is relative to the restlength and length of the corresponding muscle tension line.

For example, a value of 1.5 will cause a muscle to contract whenever this line approaches a length that is one and a half times its original rest length.

Deform

These parameters apply a point deform to the incoming muscles using the input animation source (usually, the animated Bone Geometry) purely for contextual viewing of the muscletension animation. The deformed animation is for reference only, as the muscle solver only takes the static t-pose position into account.

Output Integrity

Point deform and delta mush can potentially produce some very poor quality and/or inverted tetrahedra. The Output Integrity parameter options can help you counteract these lower quality deformation results.

Simple Deformation

Does not try to correct any malformed tetrahedra on the interior of the muscle tetrahedral meshes.

Compute Quasistatic Corrections

Run a quasistatic simulation internally to correct any malformed tetrahedra on the interior of the muscle tetrahedral meshes.

For most muscle simulations, this option will not be necessary as it adds additional compute time for motion that ultimately will not be used by the muscle solver. But for situations where better quality deformations are desired for the output of the Muscle Flex SOP, you may find the extra integrity solve of this option beneficial.

Deformation Style

Determines how the muscle deformations are performed.

Point Deform

Use a deformation lattice (point cloud) to drive the muscle deformations where each point on the lattice captures and influences nearby points on the muscle tetrahedral meshes. The closer the points, the more influence (computed using the Elendt metaball formula).

Use BoneCapture Weights

Use the muscle geometry’s skinning weights (boneCapture point attribute) and the skeleton specified by the KineFX Rig Path parameter to drive the muscle deformations.

KineFX Rig Path

Specifies the path to the KineFX skeleton that you want to drive the muscle deformations.

This parameter is only available when Deformation Style is set to Use BoneCapture Weights.

Point Deform

You can use the parameters in the Deform tab > Point Deform section to adjust the point deform parameters. For the purposes of the muscle solver, only the regions on your muscles that are designated as Muscle End regions are significant. These regions act as target constraint regions.

Muscles are deformed in this node by a Point Deform SOP so that muscle firing can be viewed “in context” with proxy animation. The animated output of this node is ignored by the solver otherwise. There is one exception to this notion however. In the Muscle Solver Vellum SOP, Muscle End Constraints have two possible modes of attaching muscles to the animation source. They can either attach to the nearest bone geometry (see the Muscle Constraint Properties SOP > Muscle to Bone tab), or the muscle ends can act more like “Pin To Animation” constraints by treating their animated positions as targets. In the latter case, the proxy animation being output by this node can be used as the animation source.

Radius

The maximum search radius for point influence. See Point Deform.

Minimum Points

The minimum number of points to find for point influence. See Point Deform.

Maximum Points

The maximum number of points to find for point influence. See Point Deform.

Rigid Projection

When on, removes any shear that may be included in the computed local transforms leaving only a rigid transform. See Point Deform.

Recompute Affected Normals

When on, any normals that are affected by tetrahedra with both deformed and undeformed points are automatically recomputed. See Point Deform.

Enable Delta Mush

When on, the node will try to preserve the shape of the muscles when applying the point deform. See Delta Mush.

Delta Mush Iterations

Specifies the number of smoothing iterations to apply to the muscles. The higher the number of iterations, the smoother results.

This parameter is only available when Enable Delta Mush is turned on. See Delta Mush.

Bone Geometry

T-Pose Source

Specifies where the rest pose that is used for the point deform is derived from.

Use Initialization Frame

Timeshift the animation source to the Initialization Frame and use the geometry frozen at that frame as the rest pose for the capture position.

From Attribute

Use the T-Pose Attribute as the rest pose for the capture position.

Initialization Frame

Specifies the frame (time) to hold or freeze the animated source geometry at and then use as the rest pose.

This parameter is only available when T-Pose is set to Use Initialization Frame.

T-Pose Attribute

The name of the point attribute (from this node’s second input) that specifies the rest pose for the capture position.

This parameter is only available when T-Pose is set to From Attribute.

Display

These parameters determine how the muscle flex deformations appear in this node’s viewport state.

Muscle Tension Visualizer

When on, a color visualizer is applied to the muscletension attribute as it is animated by the Muscle Flex parameters. Gray indicates low muscle tension and red indicates high muscle tension.

Bone Geometry

When on, the animation source geometry (from the second input on this node) is visible in the viewport state. This is most often the animated bone geometry.

Bone Color

Sets the RBG color of the Bone Geometry in the viewport state.

Muscle Tension Lines

When on, the muscle tension lines (from the third input on this node) appear in the viewport state.

Inputs

Input 1

Solid muscle geometry.

Input 2

Animation source geometry (often the animated bone geometry) and preroll.

Input 3

Muscle tension lines (autoflex_id, length, restlength).

Outputs

Output 1

Solid muscle geometry with animated muscletension.

See also

Geometry nodes