The Flex modifier simulates soft-body dynamics using virtual springs between an object's vertices. You can set the springs' stiffness, or how actively they keep vertices from coming close to each other, as well as stretch, or how far apart they can move. At its simplest, this system causes vertices to lag behind an object as it moves. At a more advanced level, you can also control the sway, or how much the spring angle can change.
Flex causes the tongue to wag as the head rotates.
Flex works with NURBS, patches, polygon and mesh objects, shapes, FFD space warps, and any plug-in-based object types that can be deformed. You can combine Flex with space warps such as Gravity, Wind, Motor, Push, and PBomb to add realistic, physically based animation to an object. In addition, you can apply deflectors to soft-body objects to simulate collision.
Note: The Flex modifier is aware of vertex/control-point motion in any animated modifier that deforms points below Flex in the modifier stack, such as the
Morpher modifier. Use this to simulate soft-body motion on a morphed or otherwise deform-animated object.
Tip: To change the center of the flex effect, after applying the Flex modifier to an object or sub-object selection, choose the Flex modifier's Center sub-object and use Move.
Tip: Using Flex's advanced capabilities can significantly impede real-time playback. To improve performance in such cases, use the
Point Cache modifier to record the vertex animation to disk, and then play it back using the cache.
The antennae, with the Flex modifier applied, move around like springs reacting to the motion of the character's head.
Surfaces Influenced by the Flex Modifier
- On a poly or mesh surface, the Flex modifier influences every vertex.
- On a patch surface, the Flex modifier influences both control points and tangent handles. Flex unlocks tangent handles and moves them independently.
- On a NURBS surface, Flex influences control vertices (CVs) or points.
- On a Spline (shape), the Flex modifier influences both control points and tangent handles.
- On an FFD Space Warp, the Flex modifier influences control points.
Effects
You can apply space warps to the Flex modifier. For example, you can add Wind to animate plants and trees, or a waving flag. In such cases, you don't need to create keyframes to see the effects; the space warp alone can animate the surface.
Character Animation
Use Flex above the Skin modifier to add secondary motion to a character animated with Bones, or above the Physique modifier to add secondary motion to a character animated with Biped.
Procedures
Example: To paint on weights:
- Create a sphere on the left side of the Top viewport.
- Turn on (Auto Key) and drag the time slider to frame 50.
- In the Top viewport, move the sphere to the right side of the viewport.
- Turn off (Auto Key).
- On the Modify panel, click the Modifier List, and then choose Flex.
The Flex modifier is applied to the sphere.
- Click (Play Animation).
The sphere flexes around the Transform gizmo evenly.
- Open the Flex modifier hierarchy in the stack display, and click Weights & Springs.
This enables modification of the Weights & Springs sub-object settings.
- In the Paint Weights group, turn on Paint.
- In the Left viewport, paint on the lower part of the sphere.
The vertex color changes as the vertex weight changes. Yellow vertices are more rigid, blue vertices are less rigid.
Tip: You can change Flex vertex colors through Customize menu
Customize User Interface
Colors
Elements=Geometry
Subselection Hard/Medium/Soft.
- Click (Play Animation).
The sphere wobbles on one side more than the other.
If the Strength setting in the Paint Vertex group is a positive value, you paint rigidity. If the values are negative, you paint flexibility.
To reverse the effect, paint with negative Strength values.
Example: To use wind as a force:
- In the Top viewport, create a sphere.
- On the Create panel, click (Space Warps), and then, if necessary, choose Forces from the drop-down list.
- Click Wind, and then click and drag in the Front viewport to create a wind gizmo.
- On the Wind Parameters rollout, set Strength and Turbulence to 4.
- Select the Sphere.
- Go to the Modify panel, and apply a Flex modifier.
- On the Modify panel Parameters rollout, set Samples to 1.
- On Forces and Deflectors rollout Forces group, click the Add button, and then select the Wind gizmo in the viewports.
- Click (Play Animation).
The sphere undulates in the wind. The Advanced Parameters rollout Reference Frame setting determines the frame where the force(s) in the list take effect.
You can also use this example to see how the Chase Springs option works.
- Turn off Chase Springs and click (Play Animation) again.
The sphere keeps moving in the direction the wind is blowing without "bouncing" back. That's because the chase springs, which attempt to return the object to its original shape, are no longer in effect.
To add custom springs:
- Apply Flex to an object and go to the Weights & Springs sub-object level.
The Flex vertices appear at object vertices in the viewports.
- On the Advanced Springs rollout, turn on Show Springs.
- Click the Options button and in the Spring Option dialog, choose how you want to add springs. Exit the Spring Option dialog.
- Select vertices according to the options.
For instance, if you want to add one Hold Shape spring between two vertices, select both vertices.
- Click Add Spring.
The new spring or springs appear. Edge springs are blue and Hold Shape springs are red.
Example: To create a swinging rope:
- Use Create menu Space Warps to add a Drag and a Gravity space warp in the Top viewport.
- Use Create menu Shapes Line to create a line with ten vertices spaced evenly in the top viewport.
- On the Modify panel, turn on (Vertex) and select all the vertices except the first vertex.
- Apply the Flex modifier.
- In the modifier stack view, open Weights and Springs sub-objects.
- Turn off Use Chase Springs.
- Turn off Use Weights.
- Set the solver to Runge-Kutta4.
- Set Samples to 5.
- In a viewport, select all the points on the spline.
- In the Advance Springs rollout, click the Option button.
- In the dialog, turn on Hold Edge Length Springs and click OK.
- Click Add Springs.
- On the Forces and Deflectors rollout, add Gravity and Drag in the Forces group.
- Click (Play Animation).
The spline resembles a swinging rope.
Example: To create cloth draping on a sphere:
- Use Create menu Space Warps to add a Drag and a Gravity space warp in the Top viewport.
- Use Create menu Space Warps Deflectors SDeflector to create a spherical deflector. Set Bounce to 0 and Friction to 100. Place the deflector below Z=0.
- Use Create menu Geometry Standard Primitives Plane to create a 20 x 20 plane in the Top viewport. It should be above the spherical deflector.
- Apply a Mesh Select modifier to the plane.
- In the Top viewport, select all the vertices except for the leftmost column.
- Apply the Flex modifier to the plane.
- Turn off Use Chase Springs and Use Weights.
- Set Samples to 3.
- Click Create Simple Soft Body.
- In the Forces and Deflectors rollout, add the Gravity and Drag forces.
- In the Forces and Deflectors rollout, add the spherical deflector.
- Click (Play Animation).
The plane drapes over the spherical deflector like cloth.
Interface
Modifier Stack
These modifier sub-object levels are available in the stack display by opening the modifier hierarchy (click the + icon to the left of the modifier name).
- Center
- Move the Transform gizmo in the viewports to set the center of the effect.
The flex effect increases as the distance between the center and a vertex increases.
- Edge Vertices
- Select vertices in the viewports to control the falloff and direction of the flex effect.
Selected vertices flex less than unselected vertices.
- Weights & Springs
- Use the Weights And Painting rollout controls to select and deselect vertices for subsequent operations on the Weights And Painting rollout and the Advanced Springs rollout.
You can paint weights at any sub-object level, and add and remove springs at any sub-object level (or even at the Flex modifier object level), but while a Weights & Springs selection is active, only the selected vertices are affected.
Parameters rollout
- Flex
- Sets the amount of flex and bend. Range=0.0 to 1000.0; Default=1.0.
This value represents the amount of the flexed animation that is used; the flexed animation is determined by other factors such as motion and vertex weighting. The default setting of 1.0 causes the flexed animation to occur unmodified; higher settings cause unnaturally high amounts of stretching, and lower settings cause diminished stretching.
- Strength
- Sets the overall spring strength of the chase springs.
A value of 100.0 is rigid. Range=0.0 to 100.0; Default=3.0.
- Sway
- Sets the time for the object to come to rest for chase springs.
Lower values increase the time for the object to come to rest. Range=0.0 to 100.0; Default=7.0.
- Use Chase Springs
- When on, enables chase springs, which force the object to return to its original shape. When off, no chase springs are used, and the amount by which vertices move depends only on their weights. Default=on.
Typically, for soft-body simulations when you want objects to be influenced by forces and deflectors, you would turn off Use Chase Springs.
- Use Weights
- When on, Flex recognizes the different weights assigned to an object's vertices, applying different amounts of flexing accordingly. When off, the flex effect applies itself to the object as a monolithic whole. Default=on.
Typically, for soft-body simulations when you want objects to be influenced by forces and deflectors, you would turn off Use Weights.
- Solver Type
- Choose a solver for the simulation from the drop-down list. The three choices are Euler, Midpoint, and Runge-Kutta4. Midpoint and Runge-Kutta4 require successively more computation than Euler, but are more stable and accurate. Default=Euler.
Tip: In most cases, you can use Euler successfully, but if unexpected object deformations occur during a simulation, try using one of the more accurate solver types. Specifically, you might need to use Midpoint or Runge-Kutta4 with higher Stretch and Stiffness settings.
- Samples
- The number of times per frame the Flex simulation is run at equal time intervals. The more samples you take, the more accurate and stable the simulation. When using the Midpoint or Runge-Kutta4 solver, you might not need as many samples as with Euler. Default=5.
Tip: If your simulation produces unexpected results, such as object vertices moving to seemingly random locations, try increasing the Samples setting.
Simple Soft Bodies rollout
Lets 3ds Max determine spring settings for the entire object automatically. Alternatively, you can use the Advanced Springs rollout settings to specify spring settings between each pair of vertices.
- Create Simple Soft Body
- Generates spring settings for the object based on the Stretch and Stiffness settings.
Note: After you use Create Simple Soft Body, you can change the Stretch and Stiffness settings without having to click the button again; the changes take effect immediately.
- Stretch
- Determines how much object edges can elongate. When Advanced Springs rollout Enable Advanced Springs is off, the Stretch setting is linked to the Advanced Springs rollout Stretch Str. and Stretch Sway settings.
- Stiffness
- Determines how rigid the object is. When Advanced Springs rollout Enable Advanced Springs is off, the Stretch setting is linked to the Advanced Springs rollout Shape Str. and Shape Sway settings.
The differences between Stretch and Stiffness are subtle, and understanding them is further complicated by the fact the two affect each other. In addition, how they work depends on object topology.
For example, say you create a box, add a Flex modifier, apply Create Simple Soft Body, and then set a high Stretch value and a low Stiffness value. If you use the box in a Flex-based dynamics simulation, such as dropping it onto a surface (deflector) with gravity, you might expect the box to fall over and flatten out. But instead, because of the box's topology, which causes Create Simple Soft Body to apply a relatively small number of shape springs, you'd actually get better results with a low Stretch value and a high Stiffness value. However, if you use a sphere of eight segments instead, you'll get the collapsing behavior with the default Stretch and Stiffness settings, and as expected, increasing rigidity with higher Stiffness settings.
In soft-body simulations, such as the preceding example of dropping an object onto a surface, particularly with dense meshes, you might get better results by applying the mesh to an FFD space warp that's bound to the object. If the object's shape isn't suitable for use with the space warp, you might have to instead use the Advanced Springs rollout settings to apply springs manually. In such cases, you should create shape springs between opposite vertices rather than adjacent ones.
Cloth-like animation usually works best with a high Stretch setting and a low Stiffness setting. For soft bodies, you would usually use high settings for both Stretch and Stiffness, depending on how "squishy" you want the object to be.
Weights and Painting rollout
When you first apply Flex to an object, the modifier automatically sets a weight for each vertex based on its distance from the modifier's center. The higher a vertex weight, the less prone it is to being affected by Flex effects. The modifier applies the highest weights to vertices closest to its center, and the lowest weights to vertices farthest from the center. So, for example, with a cylinder whose pivot point is at the base, you'll get the greatest amount of flexing at the top. But with a sphere, all of whose vertices are equidistant from the pivot point (center), all vertices have, by default, equal weight values.
The Paint Weights controls let you use a spherical brush with adjustable radius and falloff to change vertex weights in the viewports, thus controlling the amount of lag. The Vertex Weights controls let you apply absolute or relative weighting to single vertices or groups of vertices.
Paint Weights group
- Paint
- At any sub-object level, click Paint, and then drag the cursor over the mesh in the viewports to "paint" vertex weights using the current Strength and Feather settings. Vertex colors changes to reflect the new vertex weight.
Painting changes vertex weights relative to their current values; it does not apply an absolute weight. Longer strokes over an area of the mesh will increase or decrease vertex weights more than short strokes, and repeated strokes over the same area will cause incremental changes in weight values unless they're already at their extremes.
The vertex coloring shown at any Flex sub-object level provides an approximate indication of weighting. The colors are determined by the settings in Customize menu Customize User Interface Colors tab Elements: Geometry. In this list are three color entries: Subselection Hard, used to display vertices with the highest Weight values; Subselection Medium, used to display vertices with medium Weight values; and Subselection Soft, used to display vertices with low Weight values.
- Strength
- Sets the amount by which painting changes weight values. Higher values change weighting more quickly. At Strength=0.0, painting does not change weight values. Range=–1.0 to 1.0; Default=0.1.
Negative values allow you to remove weight.
Tip: When painting, you can use the
key to invert the strength.
- Radius
- Sets the size of the brush in world units. Range=0.001 to 99999; Default=36.0.
Note: If you position the mouse cursor over the object before painting, you can see a wireframe representation of the spherical "brush" that depicts the Radius setting.
- Feather
- Sets the falloff in strength from the center of the brush to its edge. Default=0.7. Range=0.001 to 1.0.
Vertices at the center of the brush are always changed by the full amount of the Strength setting, but the higher the Feather setting, the less vertices closer to the edge change. At the lowest setting, all vertices inside the radius are changed equally.
Vertex Weights group
Sets vertex weighting manually. At the Weights & Springs sub-object level, select vertices in the viewports, and then change the value of the Vertex Weight parameter. Alternatively, turn on Absolute Weight, set the desired Vertex Weight, and then select vertices to set; changes are immediate.
- Absolute Weight
- Turn on to assign absolute weights to the selected vertices. Turn off to add or remove weight based on the Vertex Weight setting.
- Vertex Weight
- Assigns weight to selected vertices.
Depending on the state of the Absolute Weight parameter, weight assignment is either absolute or relative.
Note: The Vertex Weight range is –100 to 100. With Absolute Weight on, the negative Vertex Weight settings have no effect; the effective range is 0 to 100. With Absolute Weight off, changing the Vertex Weight setting adds the amount to the current weights of selected vertices, and then the setting is reset to 0.
Forces and Deflectors rollout
Forces group
Use these controls to add space warps in the Forces category to the Flex modifier. Supported space warps are:
- [list of space warps]
- Displays particle space warps applied to the Flex modifier.
- Add
- Click this, and then select a particle space warp in the viewports to add the effect to Flex. The added space warp displays in the list window.
- Remove
- Select a space warp in the list and click Remove to remove the effect from Flex.
Deflectors group
Using deflectors with Flex lets object movement be impeded by surfaces. This lets you simulate collisions with soft-body objects. For best results with collisions, in the deflector settings use a low value for Bounce and a high value for Friction.
Supported deflectors are:
- [list of deflectors]
- Displays deflectors applied to the Flex modifier.
- Add
- Click this, and then select a deflector in the viewports to add the effect to Flex. The added deflector displays in the list window.
- Remove
- Select a deflector in the list and click Remove to remove the effect from Flex.
Advanced Parameters rollout
- Reference Frame
- Sets the first frame at which Flex begins its simulation.
- End Frame
- When on, sets the last frame at which Flex is to take effect. After this frame, the object snaps back to its shape as currently defined by the stack. For instance, if you animate a Bend modifier in the stack under Flex, then when Flex stops, the object's shape is altered only by the Bend modifier settings as of that frame.
- Affect All Points
- Forces Flex to ignore any sub-object selection in the stack and apply itself to the entire object.
- Set Reference
- Updates the viewports.
After moving the effect center, click Set Reference to update the viewports.
- Reset
- Resets vertex weighting to the defaults.
Advanced Springs rollout
Use these settings when you need a more precise springs setup than is provided by the Simple Soft Body feature. Flex uses two types of spring: edge springs, which create springs only along existing edges, and shape springs, which can exist between any two vertices in the object that are not connected by an edge. In general, add edge springs along existing edges and shape springs between vertices that don't share an edge.
Note: Before using these controls, go to the Weights & Springs sub-object level.
Tip: Additional spring types are available using MAXScript. See the MAXScript Help for details.
- Enable Advanced Springs
- Makes the numeric controls available for editing, and disconnects the Strength and Sway settings from the Simple Soft Bodies controls. Default=off.
The four numeric Stretch and Sway settings in this rollout are available only when Enable Advanced Springs is on.
- Add Spring
- Adds one or more springs to the object based on the vertex selection at the Weights & Springs sub-object level and the Spring Option dialog settings.
Note: You cannot undo this action. To delete existing springs, select the endpoints and click Remove Spring.
- Options
- Opens the Spring Option dialog for determining how springs are added with the Add Spring function.
- Remove Spring
- Deletes any springs that have both vertices selected at the Weights & Springs sub-object level.
- Stretch Str.
- Determines the strength of the edge springs; the higher the strength, the less the distance between them can vary.
- Stretch Sway
- Determines the sway of the edge springs; the higher the strength, the less the angle between them can vary.
- Shape Str.
- Determines the strength of the shape springs; the higher the strength, the less the distance between them can vary.
- Shape Sway
- Determines the sway of the shape springs; the higher the strength, the less the angle between them can vary.
- Spring Count
- Displays the number of edge springs, followed by the number of shape springs in parentheses.
- Hold Length
- Maintains the length of edge springs within the specified percentage.
Note: This setting, which is applied after the Flex simulation, can affect the object shape, and thus cause collision detection to fail.
- Show Springs
- Displays edge springs as blue lines and shape springs as red lines. Springs are visible only when a Flex sub-object mode is active.
You can change the spring colors using MAXScript.