Moov Hair Physics 

 

Overview 

Moov Physics is designed to provide the artist and TDs with different algorithms to simulate hair movement. This node provides a simple interface to work with hair simulation in real-time and a set of Python scripts to add new controls and expand its functionality. TDs have the possibilities to expand MoovPhysics developing their own Python scripts to achieve even more complex and accurate simulation. Contrary to our Dynamics Operator, Moov does not depend on nVidia Flex and can be used in any OS or graphic card.

 

Videos 


Moov introduction tutorial (Part 1)

Collisions (Part 2)
 

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

 

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.

 

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 shape conservation for strands with large number of points, in contrast to the LimitStretch 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 LongRangeLayers parameter.

 

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

This value has no effect on propagated strands.

 

RootVertexCount 

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.

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 

Here is a basic benchmark for a hair simulation with the main hair models (Test_MoovPhysicsNode.Test_MoovPhysicsNode.test_ComputePerformance_AllModels). The simulation has 300 guides with 10 points per guide and runs over 99 frames; all parameters are script defaults except ModelType and UseCompliantConstraints.

The total time difference between the fastest to the slowest model is about 20%. The differences between compliant and non-compliant versions of different models 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.

 

Sample scene 

A sample scene with a simple Moov simulation can be downloaded from HERE. The scene contains the finished curly hairstyle used for the tutorial found HERE.

The operator stack includes the Moov operator working on top of the guides and the operators that generate the hairs and hair details are deactivated to speed up the simulation. On top of the Moov operator is an Animation Cache Operator that can be used to record the simulation to an .abc file or load the .abc file included in the zip file. The included cache file includes a hair animation recorded using the Moov settings found in the sample scene.

After recording the simulation you can turn on the all the operators to see the finished project.

 

Related Topics 

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

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