Difference between revisions of "Cloth ini"

From XStoryPlayer Wiki
Jump to: navigation, search
(Created page with "cloth "braShape" { save = true; dynamic { int_steps = 4; s0 = 42.0; s1 = 8.0; s2 = 0.5; d0 = 0.08; d1 = 0.02; d2 = 0.0; Kd = 0.003;...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
For this cloth ini description the bra for the Saiko character is used as example.
 +
 +
<syntaxhighlight lang="cpp">
 +
 
cloth "braShape"
 
cloth "braShape"
 
{
 
{
 +
  // Object is created even if it is hidden
 
   save = true;
 
   save = true;
  
 +
  // Dynamic parameters
 
   dynamic
 
   dynamic
 
   {
 
   {
 +
    // Number of steps for the integrator
 +
    // Larger value can create more stability but takes more time to integrate cloth
 
     int_steps = 4;
 
     int_steps = 4;
 
+
   
     s0 = 42.0;
+
    // The cloth spring values
     s1 = 8.0;
+
    // Higher values increase stiffness
     s2 = 0.5;
+
    // Too high value can make cloth explode
 
+
     s0 = 42.0; // Spring value for general stiffness (high value makes cloth less elastic)
     d0 = 0.08;
+
     s1 = 8.0; // Spring value for shearing stiffness (makes it more cloth like)
     d1 = 0.02;
+
     s2 = 0.5; // Spring value for bending stiffness (high value makes is rubbery)
     d2 = 0.0;
+
   
 
+
    // 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;
 
     Kd = 0.003;
  
 +
    // A button
 
     button
 
     button
 
     {  
 
     {  
 +
      // These vertex rows of the bindShape are used by the button
 
       row    = (224,110,265,260);
 
       row    = (224,110,265,260);
 
       row    = (114,70,266,259);
 
       row    = (114,70,266,259);
 
       row    = (185,27,267,261);
 
       row    = (185,27,267,261);
 +
 +
      // State of button
 
       closed = true;
 
       closed = true;
 
     }
 
     }
 
+
 
 +
    // A button
 
     button
 
     button
 
     {  
 
     {  
Line 33: Line 56:
 
     }
 
     }
  
 +
    // A zipper
 
     zipper
 
     zipper
 
     {  
 
     {  
 +
      // These vertex rows of the bindShape are controlled by the zipper
 
       row = (63, 306);
 
       row = (63, 306);
 
       row = (131,305);
 
       row = (131,305);
Line 44: Line 69:
 
       row = (39, 300);
 
       row = (39, 300);
  
 +
      // The row the zipper is at
 
       closed = 0;
 
       closed = 0;
 
        
 
        
 +
      // The rendered zipper rows
 +
      // Needs two elems
 
       render_row
 
       render_row
 
       {
 
       {
Line 65: Line 93:
 
       }
 
       }
 
     }
 
     }
      
+
 
 +
     // The amount the zippers are shifted
 +
    // relative to the vertices it controls
 
     zipper_shift = 0.5;
 
     zipper_shift = 0.5;
 
+
 
 +
    // The amount the buttons are shifted
 +
    // relative to the vertices it controls
 
     button_shift = 0.5;
 
     button_shift = 0.5;
 
     button_depth = 0.0;
 
     button_depth = 0.0;
  
 +
    // The button spring and damping
 +
    // Make same as s0, d0
 
     button_s = 42.0;
 
     button_s = 42.0;
 
     button_d = 0.08;
 
     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_s = 200.0;
 
     zipper_d = 0.08;
 
     zipper_d = 0.08;
 
   }
 
   }
  
 +
  // Render parameters
 
   render
 
   render
 
   {
 
   {
 +
    // The distance corrections
 +
    // Makes cloth rendered in correct order
 +
    // A bra is below a dress
 
     vdis_correct = 0.3;
 
     vdis_correct = 0.3;
      
+
 
 +
     // The rendered object   
 
     lod[0]
 
     lod[0]
 
     {
 
     {
Line 88: Line 129:
 
   }
 
   }
  
 +
  // Physics parameters
 
   physics
 
   physics
 
   {  
 
   {  
 +
    // The mesh used for the actual springs
 
     bind_mesh = "braBindShape";
 
     bind_mesh = "braBindShape";
  
 +
    // Friction of cloth
 
     fc = 1.0;
 
     fc = 1.0;
 +
 
 +
    // Collision coefficient of cloth
 
     cc = 1.0;
 
     cc = 1.0;
 
   }
 
   }
  
 +
  // Interaction parameters
 
   interact {}
 
   interact {}
    
+
 +
   // Button
 
   button
 
   button
 
   {
 
   {
 +
    // The rendered button object
 
     render
 
     render
 
     {
 
     {
Line 108: Line 157:
 
     }
 
     }
  
 +
    // The interaction button object
 
     interact
 
     interact
 
     {
 
     {
Line 113: Line 163:
 
     }
 
     }
 
   }
 
   }
    
+
 
 +
   // Zipper
 
   zipper
 
   zipper
 
   {
 
   {
 +
    // The rendered zipper object
 +
    // Needs two elems
 
     render
 
     render
 
     {
 
     {
Line 135: Line 188:
 
     }
 
     }
 
 
 +
    // The interaction zipper object
 
     interact
 
     interact
 
     {
 
     {
Line 140: Line 194:
 
     }
 
     }
 
      
 
      
 +
    // Zipper sound
 +
    // Played when moving zipper
 
     media
 
     media
 
     {
 
     {
Line 153: Line 209:
 
   }
 
   }
 
}
 
}
 +
 +
</syntaxhighlight>

Latest revision as of 01:31, 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
    // Played when moving zipper
    media
    {
      filename = "scenes/sounds/cloth/zipper1.wav";
 
      type   = AUDIO;
      stream = false;
      pos3d  = true;
      start  = false;
      loop   = true;
      volume = 1.0;
    }
  }
}