MoovPhysics default script parameters 

 

Moov Simulation Controls 

 

PythonFileName and Reload button 

File name of the Python script for the simulation. This document refers to the parameters of the default Moov script that is loaded when a new node is created; different scripts may create a different set of simulation parameters. The script is stored and saved with the Maya scene; if the script on disk is changed (by an Ornatrix update or otherwise), Reload has to be pressed to update the script in the scene. Note that this does not change the values of the parameters; to reset the parameters back to default values use the Reset button.

 

Simulation parameters Save/Load/Reset 

Saving and loading simulation parameters allows the transfer of parameter sets between different scenes and hair objects.

 

Save button 

Shows a file selection dialog and saves the full set of Python parameters to the selected file. The result is a plain-text Python file containing a tuple with the Moov Python parameters in the same format as in the simulation script. Parameters that are not needed can be deleted in a text editor.

 

Load button 

Shows a file selection dialog and loads simulation parameters from the selected file. Only the values of parameters that are already present in the simulation script are read from the file.

 

Reset button 

Resets the parameters to their default values from the simulation script.

 

Initial state buttons 

These buttons are used to capture a certain simulation state and make it the initial state for further simulation runs. Moov state capture files are saved separately from scene files in the same directory and have the .h5 extension. They should be copied with other project files when the project is transferred to a different location.

 

CaptureInitialState button 

Captures the current state of the solver and makes it the initial state of the simulation. If an initial state already exists, it is replaced. At first animation frame, the simulation state is reset to the initial state.

 

RemoveInitialState button 

Removes the current initial state. At the first animation frame, the simulation is initialized from the previous node in the stack.

 

SimulateRestState button 

Starts an internal simulation, detached from the Maya 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.

 

Force Fields 

Used to add/remove Maya force field objects to the simulation. To do that, first add the force field object to the scene, then add it to the simulation using the Add Force Field button

 

Collision Meshes 

Used to add/remove Maya meshes to the simulation. First add the mesh to the scene, then add it to the simulation using the Add Collision Mesh button.

Notes:
  • Meshes added here will participate in collisions only if "Collide With Meshes" is set in Moov Simulation Parameters.
  • The base mesh of the hair system cannot be added in this conrol. To enable collisions with the base mesh, set "Collide With Base Mesh".
 

Moov Simulation Parameters 

 

Solver Parameters 

 

SubstepCount 

Number of simulator steps within a single animation frame. Larger values lead to slower simulation, more accurate collisions, and stiffer constraints (except in compliant models, which are less affected by this parameter).

 

IterationCount 

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

 

VelocityLimit 

Maximum speed of particles in the solver. Use to impose a speed limit on fast-moving particles.

 

CollisionTolerance 

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 Parameters 

 

LatticeCount 

Number of simulation particles corresponding to each hair vertex. LatticeCount = 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. propagated strands).

 

LatticeSize 

Distances between the particles of a lattice node (corresponding to a single hair vertex). To have meaningful lattice twist, the LatticeSize value has to be comparable to the distance between neighbour strand vertices.

Note that LatticeSize affects the hair model even when LatticeCount = 1 (i.e. no lattice). This parameter controls the perpendicular displacement of hair particles introduced to avoid unstable equilibrium in vertical guides.

 

LatticeStiffness 

Stiffness parameter of lattice nodes (used for constraints within a single lattice node).

 

ModelType 

Determines the constraints applied to the hair particles. See the overview of hair model types.

 

UseCompliantConstraints 

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.
 

LimitStretch 

Creates Long-Range-Attachment (LRA) constraints to limit strand stretching. LRA 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 StretchingStiffness parameter.

Notes:
  • Should we have GUI for tuning of LRA stiffness and overstretching?
 

SlowMovingRoots 

If on, roots are updated once per frame instead of once per substep, 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.

 

Hair Properties 

 

StretchingStiffness 

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.
 

BendingStiffness 

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.

 

RootStiffness 

Controls the stiffness of roots. When this value is equal to 1, the first two vertices of each strand are 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.

This value has no effect on propagated strands.

 

MassPerVertex 

Determines the mass of hair particles. Particle mass determines the response to:
  • force fields,
  • AttractToInitialShape springs,
  • compliant constraints (strand constraints when UseCompliantConstraints is on, and LRA constraints).
Notes:
  • The strand stiffness is not affected by particle mass when UseCompliantConstraints is off.
 

MassCurve 

Determines the root-to-tip particle mass change. The mass per vertex at a given strand position is equal to the curve value times the MassPerVertex parameter.

 

Forces and Fields 

 

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

 

GravityScale 

Scales the gravitational field felt by the hair. Use this parameter to modify the stiffness response when the StretchingStiffness and BendingStiffness 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.

 

ForceFieldScale 

Scales the external force fields felt by the hair (set in the force fields control). 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 that the preferred way to adjust the strength of force fields is by using their own Magnitude and Attenuation parameters, not via this slider.

 

ForceFieldCurve 

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.

 

AttractToInitialShape 

If enabled, creates springs that attract each strand to its initial shape.

 

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

AttractToInitialShape_Ramp 

Allows to modify the stiffness of the attraction springs along each strand, from root to tip, using a ramp curve.

 

Collision Parameters 

 

CollideWithBaseMesh 

Turns on collisions between hair particles and the base mesh.

 

CollideWithMeshes 

Turns on collisions between hair particles and collision meshes added in the CollisionMeshes box.

 

CollideWithHair 

Turns on hair-hair collisions. These are implemented by creating capsules for each hair segment. Capsules can only collide with each other.

 

CollideWithHairRadius 

Defines the radius of hair strands for hair-hair collisions.

 

Group Holder Parameters 

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

 

UseGroupHolder 

Enables the group holder.

 

GroupHolderPosMin 

First strand vertex index (from root to tip) of the group holder.

 

GroupHolderPosMax 

Last strand vertex index (from root to tip) of the group holder.

 

GroupStiffness 

Stiffness of the group holder constraints.

 

GroupRandomSeed 

Random seed for choosing the particle pairs for the group holder.

 

GroupMaxConstraints 

Maximum number of constraints per strand group.

 

Attachment parameters 

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.

 

AttachmentMeshes 

Meshes that create attachment in the enclosed volume.

 

AttachmentPerObject 

If on, a different attachment is created for each mesh in AttachmentMeshes. Otherwise, the union of all meshes is used to create a single attachment.

 

AttachmentStiffness 

Stiffness of the attachment constraints.

 

AttachmentDensity 

Density of the attachment constraints.

 

AttachmentReleaseTime 

Time when the attachment is released.

 

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.

 

DistanceOnly 

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.

 

DistanceBending 

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

 

CosseratDistance 

Like Cosserat, but creates additional first-neighbour distance constraints to control overstretching.

 

MoovPhysics 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:

  1. 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.
  2. 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.
  3. 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 represent several challenges. First, they are easy to pass through by a moving particle, or if a particle is being pulled by a constraint or a force. In this case, the strategies for fast-moving meshes should be employed to avoid overshooting.

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.

 

Related Topics 

Missing Something? Let us know if this page needs more information about the topic.