Difference between revisions of "Cloth ini"

From XStoryPlayer Wiki
Jump to: navigation, search
Line 73: Line 73:
 
        
 
        
 
       // The rendered zipper rows
 
       // The rendered zipper rows
 +
      // Needs two elems
 
       render_row
 
       render_row
 
       {
 
       {

Revision as of 01:29, 27 January 2015

For this cloth ini description the bra for the Saiko character is used as example.

cloth "braShape"
{
  // Object is created even if it is hidden
  save = true;
 
  // Dynamic parameters
  dynamic
  {
    // Number of steps for the integrator
    // Larger value can create more stability but takes more time to integrate cloth
    int_steps = 4;
 
    // The cloth spring values
    // Higher values increase stiffness
    // Too high value can make cloth explode
    s0 = 42.0; // Spring value for general stiffness (high value makes cloth less elastic)
    s1 = 8.0;  // Spring value for shearing stiffness (makes it more cloth like)
    s2 = 0.5;  // Spring value for bending stiffness (high value makes is rubbery)
 
    // Damping in direction of cloth springs
    // Don't set too high otherwise too much Energy is added to system
    // Makes cloth more stable
    // Rule of thumb: d = s / 500
    d0 = 0.08; // Damps s0
    d1 = 0.02; // Damps s1
    d2 = 0.0;  // Damps s2
 
    // General damping
    // High value makes cloth look like it is in water
    // Low value can make cloth vibrate when stretched too much
    Kd = 0.003;
 
    // A button
    button
    { 
      // These vertex rows of the bindShape are used by the button
      row    = (224,110,265,260);
      row    = (114,70,266,259);
      row    = (185,27,267,261);
 
      // State of button
      closed = true;
    }
 
    // A button
    button
    { 
      row    = (221,104,263,1);
      row    = (107,73,264,5);
      row    = (182,30,262,0);
      closed = true;
    }
 
    // A zipper
    zipper
    { 
      // These vertex rows of the bindShape are controlled by the zipper
      row = (63, 306);
      row = (131,305);
      row = (64, 307);   
      row = (296,302);
      row = (130,303);
      row = (65, 304);
      row = (129,301);
      row = (39, 300);
 
      // The row the zipper is at
      closed = 0;
 
      // The rendered zipper rows
      // Needs two elems
      render_row
      {
        elem[0]
        {
          lod[0]
          {
            mesh = "braZipperRowShape";
          }
        }
 
        elem[1]
        {
          lod[0]
          {
            mesh = "braZipperRow2Shape";
          }
        }
      }
    }
 
    // The amount the zippers are shifted
    // relative to the vertices it controls
    zipper_shift = 0.5;
 
    // The amount the buttons are shifted
    // relative to the vertices it controls
    button_shift = 0.5;
    button_depth = 0.0;
 
    // The button spring and damping
    // Make same as s0, d0
    button_s = 42.0;
    button_d = 0.08;
 
    // The zipper spring and damping
    // Make higher otherwise the render_row's are stretched too much
    zipper_s = 200.0;
    zipper_d = 0.08;
  }
 
  // Render parameters
  render
  {
    // The distance corrections
    // Makes cloth rendered in correct order
    // A bra is below a dress 
    vdis_correct = 0.3;
 
    // The rendered object    
    lod[0]
    {
      mesh = "braShape";
    }
  }
 
  // Physics parameters
  physics
  { 
    // The mesh used for the actual springs
    bind_mesh = "braBindShape";
 
    // Friction of cloth
    fc = 1.0;
 
    // Collision coefficient of cloth
    cc = 1.0;
  }
 
  // Interaction parameters
  interact {}
 
  // Button
  button
  {
    // The rendered button object
    render
    {
      lod[0]
      {
        mesh = "braButtonShape";
      }
    }
 
    // The interaction button object
    interact
    {
      mesh = "braButtonIntShape";
    }
  }
 
  // Zipper
  zipper
  {
    // The rendered zipper object
    // Needs two elems
    render
    {
      elem[0]
      {
        lod[0]
        {
          mesh = "braZipperShape";
        }
      }
 
      elem[1]
      {
        lod[0]
        {
          mesh = "braZipper2Shape";
        }
      }
    }
 
    // The interaction zipper object
    interact
    {
      mesh = "braZipperIntShape";
    }
 
    // Zipper sound
    media
    {
      filename = "scenes/sounds/cloth/zipper1.wav";
 
      type   = AUDIO;
      stream = false;
      pos3d  = true;
      start  = false;
      loop   = true;
      volume = 1.0;
    }
  }
}