Real-Time Cloth

I’m interested in learning about real-time cloth in games. First of all, I need to put together a list of games that have used real-time simulated cloth well. What games have done that?

Secondly, I’m interested in hearing from some people that have worked with cloth sims in their games. What were your experiences? Was it worth the effort? What hassles did you run into and what was the solution? I’m not interested in anyone sharing proprietary information - more of getting an impression of people’s experiences working with it.

Third, if you can point me to any resources that will help me get started learning about this topic, I’d really appreciate it.

Thanks in advance for anything you’d like to share.

I’m pretty sure R* Table Tennis had realtime cloth on the players. I’ve not used any tech like that myself.

Cloth has been used a lot more in Japanese games for years. Lots of flappy bits of clothing- scarfs and so on. It’s often been quite a simple simulation in those games though.

There’s some good cloth in Metal Gear Solid 2 on the PS2 for instance, where you can shoot out the ropes holding a tarp down. Also check out fighting games. There’s often some sort of cloth in those. Even Soul Calibur 1 on the dreamcast had fake flapping trouser legs. (Not an actual cloth sim, just wiggling the verts of certain objects).

The Hitman games had hanging drapes. So did some of the Splinter Cell games and Prince of Persia SOT games.

I haven’t worked with cloth myself, but I hear it’s the collisions where it all goes wrong.

City of Heroes/Villains has a cloth-like sim… It’s hard to call it cloth,
but their capes/overcoats behave pretty well.

If I could control the world (or at least my little part of it) I would do a
low-res (vert-wise) sim and then use that to drive a sexier rig/shader.

If you are console-based take care not to pick a solution that is hardware
specific.

We had a cloth simulation system in Saints Row. It was first created and defined in max and a tweaked in tables. I wasnt happy with the workflow but it had some decent results. The biggest problem with the system, like RobinB mentioned, was the collision. So we had to severly limit the functionality of the simulations to prevent clipping errors and mesh penetration.

For Red Faction:Guerilla the animation programmer and I created our system from scratch. I wrote the max side pipeline, creation and exporter, and he developed the system in game. I have to say I am really pleased with the workflow and it shows well in our game. I am creating simulations and putting them in game in less than 5 minutes in some cases.

There are some things that we are planning on improving once we figured out how fast our implementation is processing gameside but we will explore those later.

You can see some examples of it on the player character in these videos.
http://www.gametrailers.com/player/36476.html

http://www.gametrailers.com/player/usermovies/233790.html

It was funny watching those videos - where they’re raving about the destruction system - ignoring the destruction completely and just focusing on the guy’s nice simulated coat tails. :):

Nice looking stuff, Randal. Thanks a lot for sharing.

If you don’t mind my asking, what type of interface do you have for defining the influence of the simulation? Are you using vertex alpha to paint where the sim gets applied, or is that texture based, or something else? Do you find that the cloth gets itself into a bad state sometimes? How do you prevent that? What type of collision system does the cloth use? Any other details you can share? If you can’t talk about it that’s fine too.

Our implementation is more low tech than what you are describing. Alot of what you are saying sounds similar to the way the latest Havok cloth may work, in regards to the vertex painting and whatnot.

I’m not sure how much I can share but I have considered sharing our technique in an article gamasutra or what have you if given permission. Its fairly low tech but the implementation was successful and very inexpensive gameside.

I’ll see what I can discuss and get back with you.

Bioware’s Jade Empire had plenty of cloth and dangly ponytails, so you can get a lot of tech info on that from within Bioware (if the people that worked on it are still there). :slight_smile:

It took a long time to have it work on the game side mainly because of the accuracy of the simulation being dependent on the FPS.

So the higher the FPS, the better the cloth behaved as it had more time to find problems.

The Jade Empire cloth used simple primitives for collision, such as sphere and capsules to prevent most of the clipping, but some clipping would still happen and frankly, who cares :wink:

The dangly ponytails were handled almost the same as the cloth, with a few small-ish changes.

We setup the collision shapes (spheres, capsules) in max and specified which edges in the cloth-mesh were suppose to be used to simulate (these edges would become cloth-springs). The cloth settings (stiffness and such) were also defined in max.

Then just export it to the engine and see how it behaved.

It took a loooong time to get it to work in the engine and get the cloth settings right because the characters do such extreme fast movements and jumps in the game that it is hard to have a cloth-system based around real-world physics behave in an abnormal world :stuck_out_tongue:

If you need code, msn me. In principle the math behind the system we used was super simple and you’ll understand it within a few hours or less.

(I even got a maxscript with the basic cloth code somewhere…lol)

Is there a distinction between physics-driven bones, and cloth, in all these answers? And do people have experience using physics-driven bones instead of true cloth?

We had some basic realtime Cloth on “The Red Star” game. (ps2/xbox)
Inhouse engine and some basic spring like cloth code for cape/loin cloth flag kinds of things.

I build a simple Maxscript to apply max primitives to selected objects or bones to and they would get assigned custom properties for collision that the exporter would turn in to real colison objects and set game values from.

For control over the cloth we used vert color information on the polygon cloth objects. It let us see our cloth weighting and have it separate from our skin weights and it since it was skinned it still looked good if we had to turn the cloth off and we could see a more normal version for animation.

Ultimately, any cloth sim is bone driven on a conceptual level. “True cloth sim”
still relies on a bone/edge lattice to keep the shape of the cloth. It’s been
my experience that faking it gets you better control. All those early attempts
at physics sims were horrible failures because they didn’t account for the huge
amount of time spent adjusting the sim to produce good results.

Rob’s right to consider bones with physics constraints vs. pure cloth sim.

A hybrid approach could be applied to the bone/physics sim for subtle folds
as a vert shader, leaving the more error prone part of the cloth sim to a better
understood physics/collision system. Does that make sense?

Assassin’s Creed had some decent cloth sim on the player character’s clothing and sword. I don’t know if it was true cloth sim or bone controlled. I would guess bone controlled if I had to pick one. They seemed to really like using bones. I think there were something like 37 bones in the background pigeons you would see flying around. Crazy.

Anyway, it strikes me as a good example of what can be allowed in terms of self intersection, etc. and still have a good believable look.

Yeah, I’m pretty sure Assassin’s Creed used bones for the cloth (I’m sure I saw it in a video a while back, can’t remember where though…). Maybe Francois Levesque can fill us in on that if he’s reading :wink:

From the E3 videos I saw recently, the cloth effects they have on the new Prince of Persia game seem pretty cool, he has two floaty ribbons out the back of his head which move and flick very nicely. Again, could be clever bones.

I know UT3 has real-time cloth. You might be able to look at the process for modding UT3 and gather some insight as to how it works.

:blank:

[QUOTE=MoP;566]Yeah, I’m pretty sure Assassin’s Creed used bones for the cloth (I’m sure I saw it in a video a while back, can’t remember where though…). Maybe Francois Levesque can fill us in on that if he’s reading :wink:

From the E3 videos I saw recently, the cloth effects they have on the new Prince of Persia game seem pretty cool, he has two floaty ribbons out the back of his head which move and flick very nicely. Again, could be clever bones.[/QUOTE]
We had 3 presentations that talked about Assassin’s Creed characters last GDC, so it wouldn’t be surprising if you saw screenshots of our rig somewhere.

Random NPCs only had bones; nearly everyone is wearing long skirts in Assassin’s Creed so the rig had to be built for speed. The same rig was used on Altair - but a per-vertex cloth simulation also ran on top of it. Stability problems were fixed easily by blending more skinning during fast animations. Cloth and bone systems complement each others very well so why not use both? :slight_smile:

And yes PoP is awesome :cool:

The NBA 2K series has had realtime cloth since the first iteration that appeared on the 360. We were authoring and exporting from Maya using their cloth system. I’m not sure if they completely reverse engineered Maya’s cloth solver or if they had some help from (then) Alias, but to the best of my knowledge that’s essentially what it was, Maya cloth in realtime.

Thanks for all of the insights guys. This is really a great help. When I get a little deeper into my investigation, I may have some more specific questions. In the mean time, feel free to continue the discussion!