Creating cloth plugin

From XStoryPlayer Wiki
Revision as of 11:40, 16 March 2015 by Xwikip (Talk | contribs)

Jump to: navigation, search

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
     
      // First cloth item (can be more if you want more cloth items)
      item[0]
      {
        object      = "#plugin/My cloth 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
      }
    }
  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.