Cloth setup in XSI

NOTE: This tutorial assumes:

A) that you have knowledge of how to use XSI

B) that you have your character and cloth geometry already made

C) that you have your character already enveloped to psych0fred's Unit_Template_Beta.

D) that you have a full version of XSI 5 with the Pandemic Tools installed

Tutorial for setting up a simple cape in XSI:

For the sake of this tutorial we'll name our cloth geometry in XSI to:

my_cloth

Then make my_cloth a child of "dummyroot".

Now let's set the envelope for my_cloth.

Select my_cloth then go:

Animate/Deform>Envelope>Set Envelope -Yes

You'll enter a pick session, select the bone that you want the cloth to attach to, then right click to end the pick session.

If you made a cape and it drapes down from the neck area just envelope the cape to both left and right clavicle bones (bone_l_clavicle, bone_r_clavicle) or maybe just the neck bone (bone_neck), play around with it to get the best results for your situation.

If you made a kama then just envelope it to the pelvis bone (bone_pelvis).

This is so the cloth object will follow your unit properly, such as when jumping, rolling, crouching, etc.

Now we need to make some cloth collision, go to:

Get>Primitive>Polygon mesh>Sphere or Cylinder (or possibly a Cube)

(i've seen spheres and cylinders used by Pandemic but from my experience spheres always worked)

    • keep the default subdivisions
    • scale it with the PPG to keep the primitive properties
    • translate it into position in the 3d viewport
    • do NOT freeze their transforms

add as many spheres/cylinders/cubes as you think you need to keep the cloth from clipping through the legs, body, and torso.

Rename your cloth collision spheres c_somename, c_somename1 and so on or whatever and make them a child to the bone that you want them to move with,

the important thing here is that the name must have the prefix c_ (C underscore).

Most of the shipped cloth collision primitives made by Pandemic were named after the bone they move with, such as:

c_ribcage, c_l_thigh etc

Now, in object selection mode (spacebar) select my_cloth and go to:

File>Pandemic Tools>Create Cloth

A property page (ppg) will appear.

At the top of the ppg you will see a section titled "Collision",

in that section you will also see a button that says "Select Collision Objects", press that button and a picking session will begin.

Select all of your cloth collision primitives (ex: c_somename) then right click to end the picking session.

Now with the ppg still open you will see another section titled "Fixed Points".

Fixed points are the vertices on the cloth object that will attach to the player model, in other words these will ignore cloth properties (deformation) making it look like the cloth is actually attached to the player.

For example, if you're making a cape that starts around the neck just select the top row of vertices on the cape object and that will be the fixed portion of the cape.

Fixed points will obey your envelope weights unlike the non-fixed points, but the non-fixed points will follow the fixed points when jumping, rolling, crouching, etc.

Close the ppg since you're done with that.

Now, in an Explorer window branch select (middle click) bone_root then press the H key to hide your hp_weapons, bones, roots, effectors, sv model, and collision primitives, then select and hide the dummyroot.

Branch select dummyroot and go to:

File>Pandemic Tools>Export

and tick this box in the window:

Export Selected Models Only

then export your model giving it a name and save destination.

Now you must set up the cloth ODF,

just copy one from the assets and rename it to whatever the name of your cloth object was in XSI which would be my_cloth in this tutorial.

Open the new my_cloth.odf and enter the msh name of your exported unit without .msh appended:

attachedmesh = "name_of_exported_unit_mesh"

Don't forget to enter the code in the unit's ODF to enable the cloth ingame:

ClothODF = "my_cloth"

I also noticed that the more polygons that your cape has the better it will deform in-game but don't over-do it!

There's a few other properties which are described in the BF2 Jedi Creation.doc you can add to the cloth ODF to make it deform how you want.

There are other properties that you may have in a cloth ODF – we have rarely had occasion to use them, but they are:
(Note that [parameter] means a number, like 20.4, not [20.4])
// ---list of optional cloth parameters---
// Angle of the wind, phi and theta
WindDirection = "[angle1 in degrees] [angle2 in degrees]"
// Wind speed, in m/s
WindSpeed = [speed]
// Dampening coefficient – in some unit or other :^)  Default is 0.5
Dampening = [number]
// Drag coefficient, also in some unit – default is -2.0
Drag = [number]
// Mass of each cloth "particle" (in Kg?) – default is 1.0
ParticleMass = [number]
// Maximum world acceleration, in m/s/s – default is 20
MaxAcceleration = [number]
// Priority – cloth with lower priority is skipped,
// if not enough time is left this frame – used for the Emperor
// Default is 0
Priority = [number]
// Does this cloth have an alpha channel?  1 or 0, Default is 0
Transparent = [value]
// BF2 has 3 different types of constraints it satisfies each frame
// when computing the cloth:
// “Bend” constraints keep the cloth’s shape.
// “Stretch” constraints keep the cloth’s size.
// “Cross” constraints keep individual pieces of cloth from shearing.
// You can turn these on or off individually by specifying a
// zero for the constraint.
// For example, if you turn off "stretch" constraints the cloth
// can grow longer or shorter…
CrossConstraint = [zero or one]
BendConstraint = [zero or one]
StretchConstraint = [zero or one]

Additional Cloth Setup Notes:

Mike Zaimont (aka PAN-Fnord from Pandemic) claimed that wrap around cloth geometry (sleeves, skirts, etc) would split ingame, but FragMe! has since discovered this is due to the arrangement of the UVs on the texture, here's an excerpt followed by the source:

FragMe! wrote:

I also found out that when you are UVing the cloth anywhere the polies are not connected to another poly it creates a split in the cloth in game. Once again on the cone cloth, it is mean to be a total wrap around no breaks but if I just UV it so it is flat with the center front of the cloth at either edge of the TGA it splits in game but if I select those edges and do a "heal" so they join the split goes away.

Source

Notes from Mike Z

Cloth doesn't collide with the character's mesh - you have to add primitives (MUST be XSI primitives!) that it will collide with. Um...I don't recall what they have to be named, but they're in any mesh that has cloth so you can look for names. You just add them to the hierarchy, export the mesh and they work...as well as they will work. :^) Cloth has some "issues" with collision - cylinders don't work right all the time, but spheres and boxes do. Also, the shape you model the cloth in is the basepose for the cloth - if you model it sticking out behind the guy then it will try to always be sticking out, so model it in the at-rest position.

Also, the export process for cloth needs it to be deformable into a flat plane, so sleeves and cylinders etc are out - it will cut a seam in them. Otherwise Leia would have had a full dress.

Mike Z