Cloth in XSI? How??

How to create models in XSI and other 3D applications and make them work in Battlefront 1 & 2. Post models, tips for application usage and share anything XSI, 3DMax, SketchUp, etc.

Moderator: Moderators

Major General
User avatar
Posts: 654
Joined: Mon Jan 03, 2005 4:28 pm

Cloth in XSI? How??

Postby maxloef » Sun Nov 18, 2007 9:16 am

question people

ive got cloth SEMI working....

its ingame and it moves but it doesnt

- collide with the player
-follow you arround, as in it jsut sits in a certain locations, say you do a roll...it hoves at the original hieght...

any help on how to properly implement it??

2008 Most Original Avatar
User avatar
Posts: 3101
Joined: Sun Aug 20, 2006 5:55 pm
Location: X-Fire: caleb1117 ಠ_ಠ
Projects :: No Mod project currently.
xbox live or psn: No gamertag set

Re: cloth in xsi? how??

Postby Caleb1117 » Sun Nov 18, 2007 2:26 pm

As far as I know, no one has ever made working cloth.

However, the Russian modding team did it with the ported Revan and Bastila, so it must be possible.

General
User avatar
Posts: 791
Joined: Sat Jul 16, 2005 3:23 pm

Re: cloth in xsi? how??

Postby t551 » Sun Nov 18, 2007 4:21 pm

The cloth document says that to collide, a unit needs colth collision primitives.

Gametoast Staff
User avatar
Posts: 3294
Joined: Mon Aug 21, 2006 6:23 am

Re: cloth in xsi? how??

Postby AceMastermind » Sun Nov 18, 2007 5:01 pm

NOTE: This tutorial assumes:
A) that you have basic 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 (5.11 recommended) with the PandemicBF2.xsiaddon 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
The cloth geometry should have been modeled in the "at rest" position.
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
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 ingame.
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:
    Get>Primitive>Polygon mesh>sphere
      Pandemic used cylinders also but sphere's always work, you could also use cubes if necessary.
    Scale the sphere with the PPG to keep the primitive properties
    Use the default subdivisions
    Translate it into place
    Do not freeze their transforms
Add as many spheres as you think you need to keep the cloth from clipping through the legs, body, head and torso.
Rename your cloth collision spheres c_somename, c_somename1 etc or whatever and in the Explorer window make them a child to the bone that you want them to move with.
Most of the shipped cloth collision primitives made by Pandemic were named after the bone that 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 primtives (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 are the vertices that will ignore the 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 such as when jumping, rolling, crouching, etc.

Close the ppg and you're done, in an Explorer 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 (middle mouse click) dummyroot and go to:
    File>Pandemic Tools>Export
and check this in the window:
    Export Selected Models Only
then export your model giving it a name and save destination.

Now you need to 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 my_cloth.odf and enter the msh name of your exported unit without ".msh" appended:
Code: Select all
attachedmesh = "name_of_unit_msh"


Don't forget to enter the code in the unit's ODF to enable the cloth ingame:
Code: Select all
ClothODF = "my_cloth" //my_cloth.odf


I also noticed that the more polygons your cloth has the better it will deform ingame, but don't overdo it!
There are a few other properties you can add to the cloth ODF to make it deform how you want.
BF2 Jedi Creation.doc wrote:
Code: Select all
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 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 from the source post:
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.


You can have multiple cloth objects in a single msh, each one needs to be treated as a separate object each having their own cloth ODF with additional line in the unit ODF (one for each cloth ODF) calling for the individual cloth pieces.

Prop objects also support cloth, the ODFs should be set up the same way as outlined in the tutorial above, the only real difference being that you won't need cloth collision added to the prop.

Major General
User avatar
Posts: 654
Joined: Mon Jan 03, 2005 4:28 pm

Re: cloth in xsi? how??

Postby maxloef » Mon Nov 19, 2007 10:12 am

BIG thanx man im gonna try this out when im home (im in class atm) :D

EDIT
SLIGHTLY big problem...did that...and now it like crashes on startup....of the map

Gametoast Staff
User avatar
Posts: 3294
Joined: Mon Aug 21, 2006 6:23 am

Re: cloth in xsi? how??

Postby AceMastermind » Mon Nov 19, 2007 5:32 pm

You did something wrong then, run the game with the BF2_modtool.exe and see what errors you get in your Bfront2.log

Major General
User avatar
Posts: 654
Joined: Mon Jan 03, 2005 4:28 pm

Re: cloth in xsi? how??

Postby maxloef » Tue Nov 20, 2007 3:43 am

nvm fixed it :D

STICKY PLEASE :D

Chief Warrant Officer
User avatar
Posts: 337
Joined: Thu Feb 11, 2010 3:10 pm
Location: Zeroeditor
Projects :: No Projects I am ready to unveil
Games I'm Playing :: SWBF2-MW2-Madden 08
xbox live or psn: No gamertag set

Re: Cloth in XSI? How??

Postby AgentSmith_#27 » Sun Jan 23, 2011 11:27 am

I've run into a small problem....
Now, in object selection mode(spacebar) select my_cloth and go to:

File>Pandemic Tools>Create Cloth

A property page(ppg) will appear.


All I get are export mesh or edit flags...

Master of the Force
User avatar
Posts: 6069
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Cloth in XSI? How??

Postby DarthD.U.C.K. » Sun Jan 23, 2011 11:51 am

then you arent using the latest version of the addon i suppose. use the one that comes with the swbf2-modtools.

Chief Warrant Officer
User avatar
Posts: 337
Joined: Thu Feb 11, 2010 3:10 pm
Location: Zeroeditor
Projects :: No Projects I am ready to unveil
Games I'm Playing :: SWBF2-MW2-Madden 08
xbox live or psn: No gamertag set

Re: Cloth in XSI? How??

Postby AgentSmith_#27 » Sun Jan 23, 2011 12:03 pm

I just realized that, how silly and epicly failishly noobish of me. Thanks :thumbs:

Ancient Force
User avatar
Posts: 1271
Joined: Tue Apr 01, 2008 8:42 am
Location: Germany

Re: Cloth in XSI? How??

Postby ANDEWEGET » Fri Jan 20, 2012 7:03 pm

Thats the only topic about cloth I could find in the XSI FAQ, so Im gonna add this here:
A diagram about how the cloth constraints are stored in the msh file. Its not really nice-looking or informative for anyone without experience with 3D(its more of a visualization for programmers/me), but I just wanted to "store" this information somewhere on GT where its possible to find it.
Hidden/Spoiler:
Image

SPRS/Stretch constraint: stores straight edges(not edges going through polygons nor edges connecting fixed points), if this constraint is enabled these edges will stay the same size(size of cloth will not change). Pretty much all edges you can see in your 3D app.
CPRS/Cross constraint: stores cross edges(crossing a polygon which is not completely "made of" fixed points), if enabled, there will be no shearing(think of the edges as sticky tape, glueing the points together). Edges across quads.
BPRS/Bend constraint: stores straight edges from one border-point to the other, across the cloth mesh, if enabled will keep the shape of the cloth(I suppose it disables bending along those edges).
This is not of very much use without the .MSH tables.
Last edited by ANDEWEGET on Mon Nov 11, 2013 9:29 am, edited 2 times in total.

Rebel Warrant Officer
User avatar
Posts: 318
Joined: Thu Jun 11, 2009 3:02 am
Location: 6 planet of the Hoth system
Projects :: Designated Days Chapter 1
Games I'm Playing :: SWBF2 Mortal Komabt
xbox live or psn: icemember x

Re: Cloth in XSI? How??

Postby icemember » Wed May 23, 2012 10:11 pm

I got permission to post these in this tread.

Heres the stock collision primitives uses by pandemic to give you an idea how to set your collision primitives up.

NOTE: The capes are not primitives. They are actual models.

Stock Collision Primitives
--------------------------------------------------------
ep3 airborne
Hidden/Spoiler:
Image
Image
Image

ep3 heavy
Hidden/Spoiler:
Image
Image
Image

ep3 marine
Hidden/Spoiler:
Image
Image
Image

ep2 arc
Hidden/Spoiler:
Image
Image
Image

Return to 3D Modeling & Animation

Who is online

Users browsing this forum: No registered users and 0 guests