From ca32c59a58d37c1822e185a2d5f3d0d3e8943593 Mon Sep 17 00:00:00 2001 From: Marijn Tamis Date: Thu, 3 May 2018 18:22:48 +0200 Subject: NvCloth 1.1.4 Release. (24070740) --- NvCloth/docs/documentation/UserGuide/Index.html | 151 +++++++++++++++++++++++- 1 file changed, 149 insertions(+), 2 deletions(-) (limited to 'NvCloth/docs/documentation/UserGuide') diff --git a/NvCloth/docs/documentation/UserGuide/Index.html b/NvCloth/docs/documentation/UserGuide/Index.html index 007e3b9..ae14ec2 100644 --- a/NvCloth/docs/documentation/UserGuide/Index.html +++ b/NvCloth/docs/documentation/UserGuide/Index.html @@ -106,11 +106,64 @@
  • Collision detection
  • Local space simulation
  • Drag lift and wind
  • +
  • Distance/Motion constraints
  • +
  • Attaching cloth to animated characters
  • +
  • Unit scaling
  • + + +
  • Troubleshooting
  • NVIDIA Copyright Notice
  • +
  • Internal solver function/algorithm documentation +
  • +
  • Internal collision detection documentation +
  • @@ -142,7 +195,7 @@

    User Guide

    -

    In this section we describe how to set up NvCloth and guide you through some common features.

    +

    In this section, we describe how to set up NvCloth and guide you through some common features.

    Setup

    Some setup is required before we can start simulating. @@ -500,7 +553,101 @@ cloth->setLiftCoefficient(0.6f);

    We can also add wind to the simulation:

    cloth->setWindVelocity(physx::PxVec3(x,y,z));
    -

    It is a good idea to vary this parameter continuously to simulate gusts, making the simulation more lively.

    +

    It is a good idea to vary this parameter continuously to simulate gusts, making the simulation livelier.

    +
    +
    +

    Distance/Motion constraints

    +

    Sometimes it is useful to constrain the movements of the cloth to some limited space for stability or artistic control. +Motion constraints can be used to limit the movement of individual cloth particles to the volume of a sphere. +The following snippets show the motion constraints are setup:

    +
    nv::cloth::Range<physx::PxVec4> motionConstraints = cloth->getMotionConstraints();
    +for(int i = 0; i < (int)motionConstraints.size(); i++)
    +{
    +       motionConstraints[i] = physx::PxVec4(sphereCenter[i], sphereRadius[i]);
    +}
    +
    +

    All motion constraints can be removed using cloth->clearMotionConstraints().

    +

    The radius of all the motion constraints can be changed by setting a scale and bias using cloth->setMotionConstraintScaleBias(scale, bias). +The resulting radius of the constraints will be newRadius = scale*oldRadius + bias (clamped to avoid negative numbers).

    +

    The stiffness of the motion constraints can be set using cloth->setMotionConstraintStiffness(stiffness).

    +
    +
    +

    Attaching cloth to animated characters

    +

    Cloth can be attached in two ways: +* Updating positions of locked particles (with inverse mass set to zero) +* Using motion constraints

    +

    Sometimes a combination of both is used.

    +

    The following snippet shows how to update particle positions directly:

    +
    { //do this inside a scope, particle update will be triggered when MappedRange is destroyed
    +       nv::cloth::MappedRange<physx::PxVec4> particles = cloth->getCurrentParticles();
    +       for all attached particles i
    +       {
    +       particles[attachmentVertices[i]] = physx::PxVec4(attachmentPositions[i], mAttachmentVertexOriginalPositions[i].w);
    +       }
    +}
    +
    +

    Note that you can also set the position of non-locked particles, but that will probably result in undesirable behavior. +Note that you can also change the mass by providing different w components. This can also be used to lock and unlock particles dynamically.

    +

    Distance/motion constraints can be used in a similar way (locking the particle with a sphere radius of zero). +Motion constraints can also be used to make particles stay within a set distance from the skinned mesh of a character. +Limiting the motion of particles can improve stability and avoid unwanted cloth configurations. +Gradually decreasing the motion constraint radius along the mesh can be used to blend between skinned and physical meshes.

    +
    +
    +

    Unit scaling

    +

    Using SI units makes it easy to use physical plausible values, but is not always desirable due to precision issues or compatibility with game engines. +It is often the case that the positional units need to be scaled by some factor. +It is easy to do this when following these rules.

    +

    When scaling the distance units by factor \(n\):

    +
    +
    All linear distance values should be scaled by \(n\) including
    +
      +
    • Vertex positions
    • +
    • Compression and Stretch limits
    • +
    • Tether and rest lengths (usually taken care of by the cooker)
    • +
    • Collision shape radii
    • +
    • Collision shape positions
    • +
    • Gravity (gravity value in the cooker doesn’t matter as it is only used for the direction)
    • +
    • Wind velocity
    • +
    • Collision distances
    • +
    +
    +
    All stiffness, scale, time, and dimensionless parameters remain unchanged including
    +
      +
    • Stiffness
    • +
    • Damping
    • +
    • Stiffness multipliers
    • +
    • Tether scales
    • +
    • delta time
    • +
    • Lift/Drag coefficients
    • +
    +
    +
    +

    Fluid density (for wind simulation) should be scaled by \(n^{-3}\)

    +

    So \(n = 100\) if your data is stored in SI units (meters for linear distance) but you need the simulation to run in centimeters while keeping all other base units the same.

    +
    +
    +
    +

    Troubleshooting

    +

    Here we describe some potential problems one may run into when simulating cloth.

    +
    +

    Parts of cloth disappearing (for single frame)

    +

    Parts of the (or the whole) cloth can disappear when the simulation generates floating point NANs. +In some cases the simulation recovers after a single frame, sometimes parts of the cloth, or even the whole cloth disappear without coming back. +The most common cause for this behavior are large constraint errors.

    +

    Things too look out for are rapidly moving collision shapes, especially while air drag/lift or damping are applied.

    +

    Having air drag/lift enabled while large constraint errors are present (stretching the cloth) can generate very large impulses as drag/lift is dependent on triangle area. +Damping is less sensitive to these problems, as it doesn’t depend on other properties of the cloth.

    +
    +
    Things to try:
    +
      +
    • Increasing the solver frequency to be higher than the frame rate cloth->setSolverFrequency(300); +This helps for both decreasing collision shape penetration and improving cloth stiffness.
    • +
    • Reduce collision shape penetration (switching to local space simulation)
    • +
    • Reduce/disable air drag/lift
    • +
    +
    +
    -- cgit v1.2.3