Sign in to follow this  

Cloth - realistic collision with characters

This topic is 4665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im making an rpg, and I'm going for the paper-doll feature like in morrowind, where you can dress you character up in any combination of clothing and armour you want. Traditionally this is done by animating the clothes along with the character, but as my characters are all animated by a skeletal system that could bend limbs all over the place, I want to do it dynamically using cloth. Lets assume I've already got a basic realtime cloth system done, and I want to be able to drape these items of clothing over an animated character and have them stay on and collide with its limbs. My thoughts on the problem: 1- Attach basic geometry (eg boxes and Line Swept Spheres) to the characters skeleton to create a dynamic collision shape. This would be fast and simple to do, but the cloth would not be colliding 100% accurately, and it could possibly get caught in the joints. 2 - Model the Garment to fit a characters reference pose, then at item initialisation assign each vertex of the garment to the nearest vertex on the characters body, and then make sure each cloth vertex stays in the correct position relative to the characters vertex. Could possibly be more accurate, but may be slow, and I have no idea how well it would work. Also it would require some kind of designation of which vertices do this and which are 'loose'. I was wondering if anyone else has any ideas on this subject, as I have found endless articles on cloth simulation, none of them deal with the issue of reaction with an animated character (which at the end of the day, is the point of realtime cloth).

Share this post


Link to post
Share on other sites
The hitman write-up said something about using spheres - maybe a couple of spheres for the hips, shoulders, that kind of thing.

A sphere fits into a cloth simulation very easily, since it's basically just another vertex with incompressible connections, and I've had it working for simple shapes. I understand your concern about getting it tangled up though - I could tie mine in knots if I allowed the character wearing it to be whipped around with the mouse like an FPS, and never did find a good solution. My temporary work-in-progress hack was a button to return the cloth to it's base shape, but that's not a "nice" way to do it...

Share this post


Link to post
Share on other sites
Thanks for the reply. Do you mean spheres that represent the characters collision shape? Or spheres at certain points on the cloth mesh to provide it with collision? Do you have a link to this hitman article?

Share this post


Link to post
Share on other sites
yeah the first thing that pops into my head is spheres. sphere trees to be precise.

a simple sphere tree will make it acceptably fast to do collision with a reasonable number of cloth vertices due to their hierarchical structure, its impossible for vertices to get stuck, since in efffect the spheretree defines a smooth continuous repulsing forcefield over the entire volume of the character, and spheres are always easy to work with.

Share this post


Link to post
Share on other sites
It used to be here but it's not working :(
http://www.ioi.dk/Homepages/thomasj/publications/gdc2001.htm

I think you can get it from the google cache still, so try this:
http://216.239.59.104/search?q=cache:NJJajs1a5I8J:www.ammo.cz/link.htm%3Fuvod%3D392%26url%3Dhttp://www.ioi.dk%252FHomepages%252Fthomasj%252Fpublications%252Fgdc2001.htm%250D+cloth+simulation+hitman+taylor-expansion&hl=en&start=4&client=firefox-a

Share this post


Link to post
Share on other sites
I'm playing with something similar: I'm using blobs (or metaballs, or isosurfaces). The idea is that using control points, a field is generated by summing a strength/distance_squared component for each control point. If the field strength is > 1 you're inside the blob. if ==1, your exactly on the surface. For a given mesh, fitting control points is very hard to do (I've yet to come up with a reliable algorithm). But once you have those control points, it is very easy to do a Least Squared Error to compute the strength factors. So blobs make it easy to detect if cloth is inside the object, and easy to find the nearest surface point if you are inside. It looks pretty good for rounded type surfaces (like humans), but is impossible to look good on sharp-angled surfaces.

Share this post


Link to post
Share on other sites
sharp surfaces are a pain for clothes anyway. How are you supposed to do it? Do a per-triangle collision? brr... No way Jose.

At best, a distance computation between the points of the cloth and the triangles, and keeping that distance above a given threshold should give good results, but it's still expensive (each point may be close to hald a dozen triangles).

The cloth has to be dense enough, or the surface smooth enough.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks for the article link.

It looks like sphere trees would be very good, aside from the difficuly in generating one (beyond me).
One problem I can see with this is if an arm or leg moves too quickly in one frame and the cloth vertices 'tunnel' and get stuck on the wrong side of the limb.
You would have to make sure the cloth is very dense so the verts get pulled back to the proper side

Does anyone know any good resources or articles on generating sphere trees? Info on this seems hard to come by.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Thanks for the article link.

It looks like sphere trees would be very good, aside from the difficuly in generating one (beyond me).
One problem I can see with this is if an arm or leg moves too quickly in one frame and the cloth vertices 'tunnel' and get stuck on the wrong side of the limb.
You would have to make sure the cloth is very dense so the verts get pulled back to the proper side

Does anyone know any good resources or articles on generating sphere trees? Info on this seems hard to come by.


Hi,

You will need to check for collision before it actually collides. Do this by tracing your cloth-vertices over the change in time, dt.
I can very much recommend the Real-Time Rendering 2nd. ed. book and Tomas Akeine Möller has even been so kind to gather a few resources, online, on various topics like intersection-testing... Check it out Here

Best regards,
Roquqkie

Share this post


Link to post
Share on other sites

This topic is 4665 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this