Houdini 21.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 Otis Solver or Muscle Solver Vellum 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 Otis SOP or Muscles Properties Vellum SOP. muscletension functions a lot like a multiplier of fiberstiffness.

This node is designed to be used in conjunction with the Muscle Tension Line Activate SOP connected to the third input, unless you only wish to manually animate the muscle activation.

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

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 Otis SOP node) to input 1 on the Muscle Flex SOP node. If you plan to mirror your muscles, do so before connecting them here.

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

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

Warning

If you do not provide activated 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.

Automatically link muscles to muscle tension lines

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

    • Connecting your Muscle Flex SOP node’s inputs.

  2. Ensure that tension lines autoflex_id attribute matches the muscle_id or custom Attribute to Match attribute. If you created the tension lines using Muscles Auto Tension Lines SOP, the autoflex_id attribute should match the Muscle ID Attribute specified on that node.

Manually link muscles to muscle tension lines

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

    • Connecting your Muscle Flex SOP node’s inputs.

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

  3. Select the Activation Links tab.

  4. Toggle on Manually Link Lines to Muscles.

  5. Click Detect New.

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

    • In the viewport state, -click a muscle, press L, -click the muscle tension line that you want to link to the selected muscle, and then press Enter. You can also use ⇧ Shift + -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 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.

    Note

    If you have Match Tension Lines by Name also enabled, any muscles that don’t have an explicit activation link specified will be linked to the tension line with a matching name.

Manually animate muscle tension

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

    • Connecting your Muscle Flex SOP node’s inputs.

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

  3. Select the Muscle Flex tab.

  4. Toggle on Manually Animate Flexing.

  5. 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.

  6. In the Muscle Flex SOP viewport state, select one or ⇧ Shift - 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.

  7. 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.

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

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

  9. Repeat steps 6-8 for each muscle you want to animate the muscletension for.

Important Note

You can only see the deformation results from your keyframes by simulating your muscles.

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.

-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.

Blend

Used to key in activation gradually so that the solver can start with all muscles fully relaxed. When zero, all tension values are set to zero, when one, tension values are determined by tension line activation values and/or manually animated flex parameters.

Include Fiber Scale Range in Blend

When on, a Blend value of zero sets the minimum fiber scale to zero, and the maximum to one. A Blend value of one will set the fiber scale min and max to what was set on the Muscles Properties Otis SOP or Muscles Properties Vellum SOP.

Match Tension Lines by Name

When on, tension lines are automatically linked to any muscles with the same name as stored in the Attribute to Match attribute. The tension line names are stored in autoflex_id.

Attribute to Match

Typically this is muscle_id, but if you specified a custom attribute in your Muscles Auto Tension Lines SOP, you need to use the same attribute here for the automatic matching to work.

Update Input For Manual Flexing or Linking

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 as well as manual muscle to tension line links.

Clear All

Removes all Muscle Flex and Activation Links parameters from the parameter list.

Muscle Flex

If you wish to manually animate the muscle flexing, this tab can list the Muscle Flex parameters.

The parameters found on this tab are generated by clicking Detect New. 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 driving the muscletension muscle attribute with a corresponding muscletension attribute on a matching tension line.

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

  3. By using a combination of 1 and 2.

If your Muscle 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.

Manually Animate Flexing

When enabled, allows you to manually animate the muscle activation on a per muscle basis. Press Detect New to populate the parameter list of muscles.

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_id 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.

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 solvers only takes the static t-pose position into account.

Deform Displayed Muscles

Only deform the muscles in node display state, but don’t deform the output muscles. The simulation doesn’t require muscles to be animated when the Muscle Ends Mode is set to the default value of Constrain to Nearest Bone. The deform is not expected to look good, it is just for evaluating the activation timing.

Deform Output Muscles

Deform the output muscles. This can slow down the simulation, but is only required when using Constrain to Input Animation in the Muscle Ends Mode in your simulation.

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 Skeleton parameter to drive the muscle deformations.

KineFX Skeleton

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.

KineFX Rest Skeleton

Specifies the path to the KineFX Rest skeleton that will provide the rest transform.

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 (when the ends are constrained to input animation as opposed to the nearest bones), 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.

Bypass Tension Lines Deformation

When on, uses the positions of the lines as is. Use this when MuscleTension Lines are animatated or deformed externally.

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. This setting is useful when bones appear offset from muscles despite being in t-pose at frame 1 because the bones are not positioned at the origin.

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, muscletension).

Outputs

Output 1

Solid muscle geometry with animated muscletension.

See also

Geometry nodes