Difference between revisions of "Creating cloth plugin"

From XStoryPlayer Wiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 25: Line 25:
 
    
 
    
 
   character = "Saiko";      // Name of character (can also be e.g. Monica)
 
   character = "Saiko";      // Name of character (can also be e.g. Monica)
   name      = "Cloth name"; // Change into the name of your cloth
+
   name      = "Cloth name"; // Change into the name of your cloth, will be used in settings menu
 
    
 
    
 
   // First cloth item (can be more if you want more cloth items)
 
   // First cloth item (can be more if you want more cloth items)
 
   item[0]
 
   item[0]
 
   {
 
   {
     object      = "#plugin/My cloth name/clothObjectNameShape.obj";        // Change into your cloth object filename
+
     object      = "#plugin/Your Plugin Name/clothObjectNameShape.obj";        // Change into your cloth object filename
     stand_state = "#plugin/My cloth name/saikoClothObjectNameStand_0.dat"; // Change into your cloth standing pose state filename
+
     stand_state = "#plugin/Your Plugin Name/saikoClothObjectNameStand_0.dat"; // Change into your cloth standing pose state filename
 
   }
 
   }
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</li>
 
</li>
<li>Make sure the cloth object ans its standing state are also placed in your plugin directory. Now you should be able to use your cloth in the fast sex dungeon pack.</li>
+
<li>Make sure the cloth object file and its standing state file are also placed in your plugin directory.<br>
 +
You now should be able to use your cloth in the fast sex dungeon pack.</li>
 +
</ol>
 +
 
 +
 
 +
==Using cloth plugin textures==
 +
 
 +
 
 +
<ol>
 +
<li>Textures are normally stored inside the packs. You use a texture file in Maya and convert the object using the filemaker.<br>
 +
The texture file is then assumed to be in the same pack as the object (that uses the texture).<br>
 +
Because in most cases we want to place the plugin textures outside of a pack, we need to add a little code to the shader of that object.</li>
 +
<li>Open the <code>body.ini</code> file that describes your cloth object. In most cases cloth already has a shader description in it.<br>
 +
Suppose your cloth uses a shader with name <code>AA_cloth1</code>, we then have a shader description e.g. like this:
 +
<syntaxhighlight lang="cpp">
 +
shader "AA_cloth1"
 +
{
 +
  ...
 +
 
 +
  view_offset = 0.03;
 +
  norm_offset = 0.005;
 +
 
 +
  ...
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>We now want to overide the textures paths that are used in Maya, with texture paths that are outside the pack.<br>
 +
Add the following lines to the shader:
 +
<syntaxhighlight lang="cpp">
 +
shader "AA_cloth1"
 +
{
 +
  ...
 +
 
 +
  view_offset = 0.03;
 +
  norm_offset = 0.005;
 +
 
 +
  color_map = "#plugin/Your Plugin Name/textures/Your Color Texture.dds";
 +
  bump_map  = "#plugin/Your Plugin Name/textures/Your Bump Map.jpg";
 +
}
 +
</syntaxhighlight>
 +
You will notice that the path is prefixed with an #.<br>
 +
This will let [[XStoryPlayer]] know, not to look for the texture inside the pack but relative to the install directory.<br>
 +
The advantage for changing the path in the shader is that we don't need to change the texture path in Maya.
 +
</li>
 +
<li>We are almost done now. We do however need to create a directory with the same path inside the pack we are using to create the cloth object using the filemaker.</li>
 +
<li>Suppose your Maya cloth file is located in <code>./pack/pack_cloth/sources/scenes/character6_cloth/</code><br>
 +
then the texture files you use in Maya are located in <code>./pack/pack_cloth/sources/scenes/textures/</code>.<br>
 +
We now need to create this directory <code>./pack/pack_cloth/#plugin/Your Plugin Name/textures/</code> and add your plugin textures to it.<br>
 +
We need to do this because otherwise the filemaker cannot find the texture files and give an error for that.</li>
 +
<li>Now use the filemaker to convert the objects. Now you have created objects that can use the textures from your plugin directory instead of the textures in a pack.</li>
 +
<li>You can now use a <code>textures</code> directory inside your plugin directory that contains the textures for your cloth object.</li>
 
</ol>
 
</ol>

Latest revision as of 11:44, 16 March 2015

Cloth plugins allow for easy distribution and sharing of new cloth objects with others.

Creating a cloth plugin is pretty straightforward.

Using textures outside the packs needs a little more explanation. But once see done it it is also pretty straightforward.


Creating cloth plugin

  1. You have created a new cloth object. For using that cloth object as a plugin you need to also have a standing pose state for that cloth.
    Info on how to create cloth and the standing state can be found in Creating cloth.
  2. You can see a folder called plugin in the root directory where you installed XStoryPlayer. In it are several directories with existing plugins.
    Create a new directory with a name that fits your cloth plugin and add it.
  3. Copy the file called _plugin.ini from one of the other plugin directories into your newly created directory. We will use it as a template for the new plugin.
    This file describes where the plugin files are.
  4. Open the _plugin.ini in a text editor and make it look like this:
    cloth_object
    {
      // This cloth was created by: Your alias
      // Version: 1.0
     
      pack = "pack/pack_dungeon.bin"; // Remove this line if cloth should be used in all fast sex packs.
     
      character = "Saiko";      // Name of character (can also be e.g. Monica)
      name      = "Cloth name"; // Change into the name of your cloth, will be used in settings menu
     
      // First cloth item (can be more if you want more cloth items)
      item[0]
      {
        object      = "#plugin/Your Plugin Name/clothObjectNameShape.obj";        // Change into your cloth object filename
        stand_state = "#plugin/Your Plugin Name/saikoClothObjectNameStand_0.dat"; // Change into your cloth standing pose state filename
      }
    }
  5. Make sure the cloth object file and its standing state file are also placed in your plugin directory.
    You now should be able to use your cloth in the fast sex dungeon pack.


Using cloth plugin textures

  1. Textures are normally stored inside the packs. You use a texture file in Maya and convert the object using the filemaker.
    The texture file is then assumed to be in the same pack as the object (that uses the texture).
    Because in most cases we want to place the plugin textures outside of a pack, we need to add a little code to the shader of that object.
  2. Open the body.ini file that describes your cloth object. In most cases cloth already has a shader description in it.
    Suppose your cloth uses a shader with name AA_cloth1, we then have a shader description e.g. like this:
    shader "AA_cloth1"
    {
      ...
     
      view_offset = 0.03;
      norm_offset = 0.005;
     
      ...
    }
  3. We now want to overide the textures paths that are used in Maya, with texture paths that are outside the pack.
    Add the following lines to the shader:
    shader "AA_cloth1"
    {
      ...
     
      view_offset = 0.03;
      norm_offset = 0.005;
     
      color_map = "#plugin/Your Plugin Name/textures/Your Color Texture.dds";
      bump_map  = "#plugin/Your Plugin Name/textures/Your Bump Map.jpg";
    }

    You will notice that the path is prefixed with an #.
    This will let XStoryPlayer know, not to look for the texture inside the pack but relative to the install directory.
    The advantage for changing the path in the shader is that we don't need to change the texture path in Maya.

  4. We are almost done now. We do however need to create a directory with the same path inside the pack we are using to create the cloth object using the filemaker.
  5. Suppose your Maya cloth file is located in ./pack/pack_cloth/sources/scenes/character6_cloth/
    then the texture files you use in Maya are located in ./pack/pack_cloth/sources/scenes/textures/.
    We now need to create this directory ./pack/pack_cloth/#plugin/Your Plugin Name/textures/ and add your plugin textures to it.
    We need to do this because otherwise the filemaker cannot find the texture files and give an error for that.
  6. Now use the filemaker to convert the objects. Now you have created objects that can use the textures from your plugin directory instead of the textures in a pack.
  7. You can now use a textures directory inside your plugin directory that contains the textures for your cloth object.