Moov Physics
Moov is a physics solver that employs various technologies to create coherent and realistic hair simulations.
Simulation Controls
- Python File
This Python file refers to the default Moov script parameters that are loaded when a new Moov Physics node is created. Different scripts may create a different set of simulation parameters. The script is stored and saved with the scene. If the script on disk is changed (by an Ornatrix update or otherwise), press Reload to update the script in the scene. Note that this does not change the parameter values. To reset the parameters to their default values, use the Reset button.
- Parameters File
Moov Physics allows you to save and store simulation parameters on disk to use on different scenes and hair objects. Use this parameter to save and load such files.
Initial State
These commands capture a specific simulation state and set it as the initial state for subsequent simulation runs. Moov state capture files are saved separately from scene files in the same directory and have the extension ".h5". Copy them with other project files when transferring the project to a different location.
- Capture Initial State
Captures the current solver state and sets it as the initial state of the simulation. If an initial state already exists, it is replaced. At the first animation frame, the simulation state is reset to the initial state.
- Remove Initial State
Removes the current initial state. At the first animation frame, the simulation is initialized from the previous node in the stack.
- Simulate Rest State
This command starts an internal simulation, detached from the GUI, and runs it until the particle position changes fall below the threshold (currently 0.1). The resulting state is set as the initial state of the simulation. Use this command to simulate a starting frame for your hair simulation.
Settle Mode
In Settle Mode, Moov runs an internal simulation until the hair particles settle down and stop moving. On each animation frame, the simulation is run multiple steps until one of the criteria for stopping is satisfied. The criteria for stopping the simulation are adjustable.
Since this happens for every frame, this feature can be used to get a"relaxed" hair on each frame when the character is moving.
- Use Settle Mode
Enable Settle Mode.
- Maximum Steps
The maximum amount of steps that the simulation is allowed to take before stopping.
- Max Threshold
- Max Evaluation Time
The maximum time for the simulation.
Force Fields
Force and fields like Air, Turbulence, Gravity and others can be used in Moov to affect the hair simulation. To do that, first add the force field object to the scene, then add it to the simulation using the Add button.
- Add
Adds a force field from the scene to the simulation. The newly added object will be shown in the Force fields box.
- Remove
Removes a force field from the simulation and from the Force fields box.
Collision Meshes
This section allows you to include additional external collision meshes in your hair simulation. The Collide with Meshes option needs to be enabled. The base mesh, or the polygon mesh used to generate the hair, does not need to be added to this list, it will be included in the simulation by default but this functionality needs to be enabled with the Collide with Base Mesh option below.
This section enables you to incorporate extra external collision meshes in your hair simulation. To do so, you need to enable the "Collide with Meshes" option.
Note that the base mesh, which is the polygon mesh utilized to create the hair, doesn't require being added to this list. By default, it is included in the simulation, but you need to enable this functionality with the "Collide with Base Mesh" option(Described below).
- Add Collision Mesh
Allows you to click a polygon mesh in the viewport to include it in the simulation. The newly added polygon mesh will appear inn the Collision Meshes list.
- Remove Collision Mesh
Removes a collision mesh from the Collision Meshes list.
Simulation Parameters
- Strand Group
Isolates the simulation by Strand Groups.
Solver
- Sub-step Count
Number of simulation steps within a single animation frame. Larger values lead to slower simulation but more accurate collisions, and stiffer constraints (except in compliant models, which are less affected by this parameter).
- Iteration Count
Number of iterations in constraint projections. The difference with the previous parameter is that this one only affects the constraint response (not collision detection). More iterations means slower simulation (although the effect is smaller than the previous parameter) and stiffer constraints (up to a certain number of iterations; after that the constraint response is saturated).
- Velocity Limit
Maximum speed of particles in the solver. Use to impose a speed limit on fast-moving particles.
- Collision Tolerance
Tolerance used for collision detection. Increase this value if you observe mesh penetration (especially for open meshes). Larger values can also sometimes help remove jittering of strands when they rest on a collision surface.
Hair Model
- Lattice Count
Number of simulation particles corresponding to each hair vertex. Lattice Count = 1 corresponds to simple longitudinal particle chains. A lattice can be used to simulate some twist response in models with only distance and bending constraints (i.e., non-Cosserat and non-elaston models). Cosserat models are preferred for applications where twist is important (e.g. Propagation Modifier).
- Lattice Size
Distances between the particles of a lattice node (corresponding to a single hair vertex). To have meaningful lattice twist, the Lattice Size value has to be comparable to the distance between neighbour strand vertices.
Note that Lattice Size affects the hair model even when Lattice Count = 1 (i.e. no lattice). This parameter controls the perpendicular displacement of hair particles introduced to avoid unstable equilibrium in vertical guides.
- Lattice Stiffness
Stiffness parameter of lattice nodes (used for constraints within a single lattice node).
- Model Type
Determines the constraints applied to the hair particles. See the Overview or Hair Model Types.
- Use Compliant Constraints
Uses compliant versions of the constraints needed by the hair model. Compliant constraints have a slight computational overhead, but are more stable, so their use is recommended when simulation stability is a concern. There are several important differences in the behaviour of compliant vs. non-compliant constraints:
- Compliant constraints have unbounded stiffness (i.e. the stiffness can be arbitrarily large). The stiffness response is limited, however, so increasing the stiffness beyond a certain value will have no further effect.
- The stiffness response of compliant constraints depends on particle mass.
- Limit Stretch
Creates long-range constraints to limit strand stretching. The generated constraints are distance constraints linking all strand particles to the root. They react only to stretching (not compression) and allow for a 10% length increase before they kick in. The constraint stiffness is taken from the Stretching Stiffness parameter.
- Slow Moving Roots
When on, roots are updated once per frame instead of once per sub-step, which speeds up the simulation but decreases precision. To avoid visual artefacts, do not turn on this option if the hair roots are moving fast.
- Long Range Layers
When checked, enables the generation of long-range constraints that limit stretch and provide long-range shape conservation for the strand. Without this option constraints link only neighbouring hair particles; each consecutive layer of long-range constraints links 2nd, 4th, 8th, etc. neighbours. This option allows groom shape conservation for strands with large number of points, in contrast to the Limit Stretch option which generates a different set of long-range constraints focused mainly on eliminating strand stretch.
- Long Range Stiffness
Sets the stiffness for constraints generated by the Long Range Layers parameter.
Hair Properties
- Stretching Stiffness
Stiffness parameter controlling longitudinal strand stretching. Should be between 0 and 1.
Notes:* In compliant models, the stiffness is unbounded, so any positive value can be entered. However, stiffness is asymptotically limited, so increases beyond a certain value are unlikely to have a noticeable effect.
- Bending Stiffness
Stiffness parameter controlling strand bending. This is applied to any constraints that serve to limit strand bending, depending on the model. In Cosserat models, this is also the twisting stiffness.
- Root Stiffness
Controls the stiffness of roots. When this value is equal to 1, the first dynamic vertex of each strand is fixed. This keeps the orientation of the strand fixed with respect to the base mesh, without any flexibility at the root. For values smaller than 1, some flexibility at the root is allowed. For a value of 0, there is no resistance when bending the root - the first dynamic vertex of the strand bends freely in all directions.
Node: This value has no effect on propagated strands.
- Root Vertex Count
Sets the number of fixed, non-dynamic (i.e. root) vertices at the base of each strand. The dynamic (moving) vertices start after the fixed portion.
Note: This value has no effect on propagated strands.
Force and Fields Properties
- Gravity
Vertical gravitational acceleration. Use to impose appropriate length units in the scene: e.g. if the scene units are centimeters, set this parameter to -981 (cm/s^2); if the scene units are meters, set it to -9.81 (m/s^2).
- Gravity Scale
Scales the gravitational field felt by the hair. Use this parameter to modify the stiffness response when the Stretching Stiffness and Bending Stiffness do not allow sufficient flexibility in hair setup. For example, if the hair is too stretchy even at maximum stiffness, increasing this parameter will lead to stiffer strands. Note that this parameter affects only the stretch of free-falling hair. Inertial stretch (i.e. stretch due to a fast-moving base mesh) is not affected.
- Force Field Scale
Scales the external force fields felt by the hair (set in Force Fields). A value of 1 leaves the forces values unchanged; decreasing this value decreases the forces proportionally. If the simulation becomes unstable due to the addition of force fields, decrease this value until stability is restored.
Note The preferred way to adjust the strength of force fields is by using their own Magnitude and Attenuation parameters, not via this slider.
- Force Field Channel
Use Strand Channels to adjust the force-field response on a per-strand or per-vertex basis.
- Force Field Curve
Adjusts the strength of the force-field response from root to tip of each strand.
- Drag
Multiplies the velocity of each particle at each simulation step. Should be smaller than 1 to avoid instabilities. Use to introduce damping (energy loss) in the system; the smaller the value, the larger the damping.
Attract to Initial Shape
When on, creates springs that attract each strand to its initial shape. Use this option to help preserve the shape of the groom.
Attract to Initial Shape Stiffness
Determines the spring stiffness. Unlike constraint stiffnesses, this value can be arbitrarily large.
Note: For consistency with other stiffness parameters, internal scaling is applied to make sure that values of 0-1 are meaningful. The scaling constant can be changed to obtain satisfactory defaults.
Attract to Initial Shape Channel
Use Strand Channels to adjust attraction strength in a per-strand or per-vertex basis.
Attract to Initial Shape Curve
Allows to modify the stiffness of the attraction springs along each strand, from root to tip, using a ramp curve.
Collision Properties
- Collide with Base Mesh
Enables hair collisions between hair particles and the base polygon mesh used to generate the hair when using the Guides from Surface workflow. The base mesh does not need to be added to the Collision Meshes list for this to work.
- Collide with External Meshes
Enables collisions between hair particles and collision meshes added in the Collision Meshes list.
- Collide with Hair
Enables hair-hair collisions. These are implemented by creating capsules for each hair segment. Capsules can only collide with each other.
- Collide with Hair Radius
Defines the radius of hair strands for hair-hair collisions.
- Particle Radius
- Particle Radius Channel
- Particle Radius Curve
- Friction Coefficient
- Restitution Coefficient
Group Holder
The group holder creates constraints to hold together each group of strands. The constraints are created between randomly selected particle pairs within a certain range of strand vertex indices (min and max position).
- Use Group Holder
Enables the Group Golder.
- Group Holder Pos Min
First strand vertex index (from root to tip) of the group holder.
- Group Holder Pos Max
Last strand vertex index (from root to tip) of the group holder.
- Group Stiffness
Stiffness of the group holder constraints.
- Group Random Seed
Random seed for choosing the particle pairs for the group holder.
- Group Max Constraints
Maximum number of constraints per strand group.
Attachments
Hair attachments are a group of hair particles (from different strands) that are linked with distance constraints. They can be used to bind certain regions of the groom together. Attachments are created at the start of the simulation and released at a specific time selected by the user.
- Attachment Meshes
A list of polygon meshes that create attachment in the enclosed volume.
- Attachment Per Object
When on, a different attachment is created for each mesh in Attachment Meshes list. Otherwise, the union of all meshes is used to create a single attachment.
- Attachment Stiffness
Stiffness of the attachment constraints.
- Attachment Density
Density of the attachment constraints.
- Attachment Release Time
Time when the attachment is released.
Visualization Controls
Draws in the viewport a visual representation of every aspect of the simulation. This is very useful to debug your simulation.
- Visualize Solver
Enables the visualizer.
- Show Particles
Draw the hair particles.
- Show Constraints
Draw the constraints.
- Show Contacts
Draw the collision contacts.
- Show Collision Meshes
Draw the triangles of the collision meshes.
- Show Velocities
Draw the particle velocities in the simulation.
- Particle Scale
Set the scale of the particle drawing.
- Velocity Scale
Set the scale of the velocity drawing.
- Force Threshold
- Contact Scale
Set the scale of the contact drawing.
Overview of hair model types
Benchmarking hair simulations with the different hair models shows that the performance (simulation time) differences between models do not exceed 20%. The differences between compliant and non-compliant versions of the same model are practically negligible.
Distance Only
A model using only distance (spring) constraints. Constraints are created along each strand between first neighbours (to control stretching) and second neighbours (to control bending), with the corresponding stretching and bending stiffnesses.
This model is the fastest, but has somewhat unrealistic bending (strands tend to buckle). To add some degree of twisting response, it is necessary to create a lattice.
Distance Bending
This model uses distance constraints between first neighbours to control stretching and three-particle bending constraints at each strand vertex for bending control.
Bending is more realistic than the Distance Only model, but hair may be too stretchy in some cases. Similar to the previous model, a lattice is needed for twisting response.
Cosserat
Uses two-particle stretch-shear and three-particle bend-twist Cosserat rod constraints, with the corresponding stretching and bending stiffnesses. Slower than the previous models, but the strands have full elastic response.
Cosserat Distance
Like Cosserat, but creates additional first-neighbour distance constraints to control overstretching.
Moov Physics Hair Simulation How-To
Hair Stiffness
The elastic response of hair is affected by many of the Moov GUI parameters, as well as by the hair scale and geometry. Adjusting the "Stretching Stiffness" and "Bending Stiffness" parameters should be sufficient for most tasks; however in some cases obtaining the desired elastic response requires additional tuning. The most common case is when even at maximum stiffness (1) the hair remains too "stretchy".
Stiffer hair can be obtained by adjusting several parameters. Each of the following options can be used on its own, and some of them are effective in combinations as well. The recommended sequence to try out is as follows:
Adjust the stiffness parameters
Before trying anything else, try adjusting the "Stretching Stiffness" and "Bending Stiffness" parameters to produce the desired stiffness.
Use an appropriate hair model
Try one of the hair models that include additional distance constraints. For the standard scalar constraint models this is "DistanceOnly"; for Cosserat rod models (that include twisting response) the model with added distance constraints is "CosseratDistance". Note that the stiffness response is different for the different models, so make sure to try different stiffness values.
Use the option to limit stretch
If all models are too stretchy even at maximum stiffness, the "Limit Stretch" option adds more distance constraints to limit hair stretching. A specific type of constraint is used which reacts only to stretching, not to compression.
Use compliant constraints and lower the particle mass
Unlike standard PBD constraints, compliant constraints are affected by particle mass. Therefore, using compliant constraints (parameter "UseCompliantConstraints" in the GUI) provides an additional way to manipulate hair stiffness. Lowering the "Mass Per Vertex" value will result in stiffer hair. Note that the particle mass also affects collision response and "Attract To Initial Shape" behavior, so this may affect other aspects of the simulation along with the hair stiffness.
Adjust the number of iterations and/or substeps
The "Iteration Count" and "Substep Count" parameters affect to some extent the stiffness response. To obtain stiffer hair, try increasing "Iteration Count" first; if this cannot produce the desired results, increase "Substep Count". Note that increasing any of these parameters will slow down the simulation; the slowdown is more significant when increasing the substep count.
Adjust the number of points per strand
The number of points per strand is usually dictated by other considerations (i.e. the level of detail desired), so this is not always possible. If you can afford it, though, decreasing the number of points per strand (i.e. changing the point count in the GuidesFromMesh node) is a very effective way to obtain stiffer hair.
Dealing with fast-moving hair
If the stretching of the hair is caused by a fast-moving distribution mesh, and the above methods give no results, it may be necessary to increase the "Velocity Limit" parameter to allow hair particles to respond to the motion. Generally, if increasing this parameter changes the simulation in any way, this is an indication that its value is too small. Increase until no further changes are observed and then try the above methods. Note that large values of this parameter can lead to instabilities.
Fast-moving collision meshes
Fast moving collision meshes can lead to various undesired artifacts in the simulation, such as overstretching of hair, penetration of particles in the collision object, etc. The general approach to avoiding these artifacts requires three steps:
- Make sure there is sufficient substep resolution for collision detection. As a general rule, the displacement of a collision mesh in any direction during a single substep should be smaller (preferably several times) than the mesh dimensions in this direction. Increase "Substep Count" until this condition is fulfilled.
- Make sure that the particle velocity limit is high enough so that particle can respond to collisions, by increasing the "Velocity Limit" parameter until its further increase does not affect the simulation.
- If needed, make sure the hair is sufficiently stiff. Fast moving meshes tend to "drag" colliding hair particles with them if the hair is too stretchy. Use the steps described in the section on hair stiffness.
Thin collision meshes
Thin meshes pose multiple challenges. First, they can be easily passed through by a moving particle or when a particle is pulled by a constraint or force. Employing strategies for fast-moving meshes can help avoid overshooting in such cases.
Another possible problem with thin meshes becomes apparent during collision with hair strands, represented by particle chains linked by constraints. Since only the particles participate in collisions (not the linking constraints), the thin mesh can pass between two neighbor particles, creating the impression that the hair passes through the mesh. To avoid that, the only option is to increase the collision tolerance or the particle radius to a value that ensures the distance between the collision volumes of two neighbor particles is smaller than the smallest dimension of the mesh.
The above situation can also lead to additional problems, such as overstretching hairs if the mesh is moving. These can be solved using the steps described in the section on hair stiffness.