Dynamics V – 2 Crash Course on Sims and Settings

Understanding cloth and having a mental model of the physics involved is necessary but not sufficient to make effective and efficient simulating systems. Creating those systems is a world in its own right. Especially those with an engineer’s way of looking at things might be interested in this mini tour through the deep down dungeons. Crash Course on Math & Physics (previous page) and Crash Course on Sims & settings  (this one) really are the math and physics loaded chapters. Any use of the underground escape tunnel brings you into Muppets Lab “where the future is made today”. You have been warned.

In this chapter, I’ll consider the simulation algorithms themselves. Finally, I’ll present some conclusions that help you further in handling the Poser parameters and cloth simulation.

Going Sim

Creating a computer simulation of a mechanical system requires the build of a ball-and-spring network. Like a mesh, the vertexes are small balls with carry all the mass, while the edges connecting the vertices are small (mass-less) springs which do the pushing and pulling. Balls and springs both take their share in damping, and the balls pick up the external forces and limitations like gravity, attached weights, air-damping, collision and friction to objects.

In order to make the simulation work like the real thing, various technical (constructive) aspects require attention. Building goods simulations is a serious profession. To name a few:

  • Resonance
    mentioned already as a ‘natural aspect’ of electrical and mechanical circuits. What does it do?
    Say, the resonance frequency is: 100. This means that a vertex is oscillating around its proper place to be, at 100 times a second, real world time (as the values for Damping, Spring strength, Mass, Object size etc. are real world values). If the simulation recalculates the positions of the vertices in steps of 1/1000 of a second, the oscillation would be clearly visible: a predictable instability. The oscillation is samples ten times a period.
    If the simulation recalculates the vertex position each 1/60 of a second, the neat oscillation would appear as a random jumping around, as a noise, an unpredictable instability. The oscillation is samples less than once a period.
    In all cases, an instability which makes that the sim needs longer calculation times to arrive at a steady result. In other words; we have to wait till the oscillation-energy is faded away. The best way to speed that up, is to increase the damping, as this stands for energy loss per second.
  • Mesh density
    in how many subparts do I chop the system? In cloth, which can be considered a surface, halving sizes in two dimensions imply quadrupling the amount of balls and springs, and calculation time. In Poser I’ve seen pieces of cloth chopped into pieces of 5x5cm (divides 1 m2 into 400 balls) to 1x1cm (10.000 balls), but a cotton fibre is as thin as 0.1mm (100 million balls per m2) and no one is building a sim like that. But by not doing so, one runs the risk of “finite element artifacts”.
  • Non linearity
    as long as the mechanics, the systems and the forces considered are linear, increasing mesh density has no effect. For instance, the cloth has a mass density of 1kg/m2, and whether I chop it into 10.000 or 100 million balls will not have effect on the effects of gravity or air damping on the cloth. And when the cloth is 1 m x 1 m and I chop 1 horizontal fibre into 100 little springs, or 10.000, will not have effect on its sheer stretching behavior. But when things are non-linear, mesh density makes a difference.
    • Resonance.
      as discussed in the electrical and mechanical sections, each system has some kind of resonance frequency for which the damping is minimal. If I give the system a kickstart, it will send all sorts of signals around in all sorts of frequencies (noise like) but the resonance one stays alive the longest. For mechanics, it’s proportional to sqrt(S/M) for spring strength (say: stretch resistance) S and mass M.
      Now I chop the cloth into pieces, at mesh density d. For instance, d=100 chops the 1x1m cloth into fibers of 1 cm (with stretch resistance S/100) and pieces of 1x1cm (with mass M/10.000).
      As a result, the resonance frequency goes up a tenfold (sqrt(d) to be precise). As stated above, this affects the noisiness, the randomness of the vertex positions.
    • Folding
      one can imagine that making an angle between two adjacent polys in a mesh is easy for very small distortions but becomes quite hard for the larger angles. Each extra degree of bending requires more and more force to accomplish. So if the 1x1m cloth is divided into 10x10cm pieces and I need a 30° between two adjacent pieces, or the cloth is divided into 1×1 cm pieces and I need 3° between two adjacent pieces but for 10 pieces in a row, the latter requires less force to accomplish.
      In Poser terms: with the same fold-resistance, finer meshes will fold easier. Mesh density makes a difference.
  • Edge effects
    You might have experienced it when making waves with a heavy rope or garden hose (if not, give it a try). When the other end is loose it jumps up end down wildly. Actually, when your waves in the rope have some amplitude, the loose end will show you the double. You can create some constant wave in the rope if you manage to pick a frequency that creates a specific length of the wave: such that there are ¼ , ¾ , 1 ¼ etc waves in the length of the rope.
    When you fix the other end, to a wall or a pole, the other end will be still at any time. You can still make those standing waves but at different frequencies, such that there are ½, 1, 1 ½ etc waves in the length of the rope.
    Not only ropes and garden hoses, but simulations as well suffer from edge effects. At the end of the ball/spring network, balls have less springs attached. Does that require heavier balls, more strength for the remaining springs attached to those balls, or just the other way around? Does the sim require fixation (like the rope at the wall) or does it allow for jumping around (like the open end case)?
    Anyway, as the image illustrates, the vertices at the edge of a mesh behave different because they are missing forces, as the springs (in between edges) are not there.
    All this is up to the sim builder, and there is no real escape. No sims without edge effects, unless one can make calculations on an edgeless world (a globe, e.g.). For cloth and clothes, one might give the edges specific treatment, like is done with real clothes. A rim, with higher mass / density, less stretching and less folding.
  • Calculation order
    There are various ways to get the results of a simulation. Iterating step by step is always required, but one can take a ball/spring network in iteration N, and use that information only to calculate the next iteration N+1. A layered approach, so to speak. Another, more continuous approach, is to take a vertex with the information from iteration N, plus the already derived information for surrounding vertices from iteration N+1, and calculate the iteration N+1 for that vertex.
    Again, this is up to the sim builder and there is no escape. The first approach requires more memory (as two nets have to be kept in store) and requires more iterations (as less info is used per step), but is easier to implement as a multi-threaded routine, it will be less prone to edge effects, and if any these will be distributed quite evenly along all edges. The second approach requires less resources, less iterations, but is typically a single-thread routine which will add directional effects to the edges. That is; it will calculate the vertices in a specific order, like top to bottom left to right so edge effects will typically appear in the top left or bottom right corner.

First, there is gravity only. But having the first ball moved will skew the forces on the second, and so on.

Then, you will get this, a piece of cloth skewing to the right-bottom corner when let loose.

I suspect modern simulators like Marvellous Designer to be of the first kind, and Poser Cloth Sim of the second kind as it stems from the Poser 5 period (even before) and has hardly seen a methodical update after then.

  • Unsimulated aspects
    Aspects of cloth which are absent in the sim, are: thread thickness, and weave density. Thicker threads make thicker cloth, with more weight per square inch, are harder to fold especially over large angles, are harder to stretch, and might increase the friction between threads. This friction between threads by itself affects shear and folding, affects air damping, and so on. A high weave density (threads x thickness per stretching meter) has similar effects.
    Modern advanced cloth simulations take threads and weave aspects into account. Poser cloth room limits itself to global cloth descriptors which include named details. From that, Poser simulates non-woven materials as well; leather, fleece, rubber and the like. This implies a simulation mechanism which is further away from physical details in the real world.

Perhaps you’re familiar with software creation. Then you’re aware that only 20% of the effort really goes to the program’s functionality, and 80% is about the user interface, preventing people from inputting erroneous values or clicking buttons at the wrong moment or selecting impossible combinations of options; that is: making the software user aware. For sims, things are about similar. 20% is about the simulation itself and 80% is about handling the resource requirements, the artifacts from resonance and edges and non-linearities of nature.
This implies that you might have to upgrade yourself from a Poser User to a Poser Sim User.

Going Poser Cloth Room

Offering a cloth simulator to end users introduces a guaranteed set of shortcomings which are not well understood, by those users at least. Not simulating various aspects of cloth (thread thickness, weave density, weave structure) makes it harder to translate the real world to sim parameters, and impatience combined with insufficient resources introduces algorithms with additional artifacts (like skewing cloth).

Mesh structures, mesh densities and various resistance and damping settings will affect the presence or absence of edge effects and resonance, which – at least from an end users perspective – introduce seemingly random vertex movements and floppy edges. Increasing mesh densities, resistance and damping as well as longer simulation times (more frames) kill those effects eventually. Sometimes raising the damping might just make things worse instead of better. But for most people it’s unclear that they have to cope with simulation artifacts that have nothing to do with cloth behavior or with their use of Cloth Room.

In the end, it’s clear not what is meant by the various kinds of parameters:

  • Resistance, against pulling or torque, is like electrical capacity: it stores energy in the cloth and releases it later on.
  • Damping is like electrical resistance: it turns cloth movements into energy loss and brings the system to a standstill.
  • Gravity, Friction and Wind make the forces (via Mass, or: Cloth Density), and so generate the energy for Resistance to store and for Damping to lose. Which effectively make these the drivers of the simulation.

Unsupported aspects

When I take the backdoor to enter the stage Cloth Room behind the scenes, that is: I take a look at the Python manual, I find some parameters which go unsupported by the properties dials in the 4th panel of the cloth room. These are all of them:

  • Airdamping         Dial: Air Damping
  • Clothclothforce        always 10, no way to set it manuall (python script required), unclear what is does
  • Clothfriction         Dial: Cloth Self Friction
  • Dampingstretch         Dial: Stretch Damping
  • Density             Dial: Cloth Density (grams per cm2, 1g/cm2 = 10kg/m2)
  • DynamicFriction     Dial: Dynamic Friction
  • FrictionFromSolid     Checkbox: Collision Friction. If checked, the Object parameter are used instead of the Cloth parameters. So either cloth shows a different behavior over rough and smooth object surfaces but the same for all cloth elements, OR cloth shows a different behavior for various cloth elements but the same for all collision objects. In one sim one cannot have both, various cloth elements over various surfaces.
  • FrictionvelocityCutoff  always 30 (cm/s), no Dynamic Friction below this speed, no way to set it manually
  • ShearResistance     Dial: Shear Resistance
  • SpringResistance     no way to set it manually, might be related to EdgeSprings, which are OFF (0)
  • StaticFriction         Dial: Static Friction
  • Thickness         is derived from Collision Depth and Collision Offset, which define distances between the outside of the object and the outside of the cloth, which are the parts we see. These collision parameters BTW are aspects of the objects, not of the cloth so in one sim all cloth elements have the same thickness for a specific object, and another thickness or another object. So Cloth Thickness is not very well represented. I guess it doesn’t do anything
  • U-BendRate         not used, no way to set it manually
  • U-BendResistance     Dial: Fold Resistance
  • U-Scale             purpose is unclear, no way to set it manually
  • UseEdgeSprings         0/1 whether to use Edge Springs calculations. No way to set it, though. It’s OFF (0). Here you have the ability of Cloth Room to manage edge effects, as discussed in earlier chapters.
  • U-StretchResistance    Dial: Stretch Resistance
  • V-Bendrate         V-values are not used
  • V-BendResistance      ditto
  • V-Scale             ditto
  • V-StretchResistance    ditto

File layout

Cloth info about a cloth prop or cloth figure is stored in the pp2/ppz (prop) and cr2/crz (figure) respectively, and looks like:


    vertsGroup _default_
        {
        v 0 
        v 1 
        … 
        v 6003 
        v 6004 
        stitchVertsGroupProperties 
            { 
            U_Bend_Resistance 30.000000 
            V_Bend_Resistance 5.000000            \ no dial 
            U_Stretch_Resistance 40.000000 
            V_Stretch_Resistance 50.000000        \ no dial 
            Shear_Resistance 50.000000 
            U_Scale 1.000000                \ no dial 
            V_Scale 1.000000                \ no dial 
            Density 0.010000 
            Thickness 0.000000                \ no dial 
            Spring_Resistance 5000.000000 
            Air_Damping 0.020000 
            Dynamic_Friction 0.100000 
            Static_Friction 0.500000 
            Friction_Velocity_Cutoff 30.000000    \ no dial 
            Cloth_Cloth_Force 10.000000        \ no dial 
            U_Bend_Rate 0.000000            \ no dial 
            V_Bend_Rate 0.000000            \ no dial 
            Cloth_Cloth_Friction 0.000000 
            Damping_Stretch 0.010000 
            get_friction_from_solid 0 
            Use_Edge_Springs 0                \ no setting 
            anisotropic 0                    \ no setting 
            } 
        } 
    vertsGroup _choreographed_ 
        { 
        } 
    vertsGroup _constrained_ 
        { 
        v 3 
        v 6 
        … 
        v 5752 
        v 5753 
        } 
    vertsGroup _softDecorated_ 
        { 
        } 
    vertsGroup _rigidDecorated 
        { 
        }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.