PDA

View Full Version : Cloth Collision Detection



Surrealist.
09-09-2005, 07:00 PM
Why is cloth collsion so convoluted?

Where is the setting that says. "Cllolide with this object period. No matter what else happens, cllolide."

And I want it to say that, really. Right there in the interface :)

Or "Exclusive collision, no really we mean it..."

A little wry Strannahan humor is needed here.

Well sreriously though, why is it such a pain to just get the object NOT to pass through the collision object?

Why do ten other settings all effect this? And lastly, if anyone has any tips, please feel free to enlighten.

Thanks.

MonroePoteet
09-10-2005, 06:14 PM
I think the basic issue is performance. Calculating collisions for a plane is substantially less intensive than calculating them for object subdivisions. Only the artist can determine if a less intensive collision calculation is "good enough" for a particular scene, and I'm glad LW gives me the option of choosing which one's right in each instance.

I think "Object-Advanced" is the highest granularity of collision detection you can set, but I could be wrong. That's what the documentation seems to suggest. Setting "object-advanced" has fixed more than one problem I've had with cloth collision detection, so it might work for you.

Regarding the "convoluted" interface, I think LW just tries to give everybody the options to balance between adequate imagery results and performance. I'm just as happy that they don't try to pretty it up by giving us just a big old slider, or fewer options, or bundling options into a few "choices", or other ways of taking the raw decision making away. Just my opinion, though. The versatility certainly takes some getting used to.

mTp

Dodgy
09-10-2005, 08:58 PM
Yeah, if you use the sphere collsion shape, and put a couple in, you can get quick collisions without faffing about..

Surrealist.
09-10-2005, 11:18 PM
I think the basic issue is performance. Calculating collisions for a plane is substantially less intensive than calculating them for object subdivisions. Only the artist can determine if a less intensive collision calculation is "good enough" for a particular scene, and I'm glad LW gives me the option of choosing which one's right in each instance.

I think "Object-Advanced" is the highest granularity of collision detection you can set, but I could be wrong. That's what the documentation seems to suggest. Setting "object-advanced" has fixed more than one problem I've had with cloth collision detection, so it might work for you.

Regarding the "convoluted" interface, I think LW just tries to give everybody the options to balance between adequate imagery results and performance. I'm just as happy that they don't try to pretty it up by giving us just a big old slider, or fewer options, or bundling options into a few "choices", or other ways of taking the raw decision making away. Just my opinion, though. The versatility certainly takes some getting used to.

mTp

You are actually completely on the money here. Do doubt that the idea is to be flexible.

I am definately open for tips in this area which is why I posted this.

Thanks, dodgy for the idea, I had thought of that and had it in my hip pocket, I really do want to learn this stuff though and I think the interface sucks and I think that it is bugged all to heck and yes I think that you should as an artist among all of the other optioins there should be a button that says NO passs through. My reasoning is this has ablsolutely nothing to do with the quality of the cloth. I have been messing with this for a couple of days. The right quality cloith gives me pass through the no pass through settings give me horrible cloth.

I think this option would bring on more possiblitites not less. If you are working with a liquidy flowing blob and want to control i's viscosity and so on and control how it slides off or through something like you fingers fine. All of the settings in there will give you plenty to mess with.

However if you want cloth - as the name suggests - then you are extremely limited as to how it reacts with a clollision object.

These are just my opinions at this point.

So, all that said I still want to learn it so bring on the tips.

Thanks.

MonroePoteet
09-12-2005, 10:21 AM
After playing with this quite a bit yesterday, Cloth collision detection certainly seems broken to me except in the simple cases (sphere, plane, etc.). Object collision (object, object-subdiv, or object-advanced) don't seem to work well.

My test setup was a simple subdivided plane for cloth with gravity, and a flattened sphere object (pancake like) for collision. After hours of working, I still can't get it to keep from passing through the polygons of the collision object, especially on the edges.

So, I'd agree with your initial post. Sorry for my rather glib "performance" post.

mTp

Mebek
09-12-2005, 10:35 AM
I have similar issues with a dress on a character. I tell it to consider the body a collision object, set to obj-advanced, and still the dress passes through the legs like they aren't even there. I just simply don't get why this is happening. I had it working on the character before I animated it, and now it's like the legs aren't there at all - not even in the 'default' position (I do have subdivision order set to last on both objects).

Dodgy
09-12-2005, 11:14 AM
I found that understanding how the collision works is the main key to successful cloth collison.

Basically it's the points from the cloth object which collide with the polys of the collison object.

Imagine a sharp corner on say a table. Now if the points in a table cloth don't align really well, one point will hit the top of the table, and an adjoining point will fall over the side. This means the connecting polygon will intersect the edge of the table and you'll see it.

As you increase the collision radius on the table, hopefully the top and side points of the cloth will be pushed further from that intersection, so it doesn't look like it's intersecting, that's basically why the radius setting is there, to try and eliminate this. However if it's too high, you'll see the rest of the points of the cloth not actually on the table.

The better way to do this is by subdividing the geometry of the table cloth near the edge, so hopefully this will narrow the area in which the cloth intersects, and you can use a smaller collison radius so it actually falling on the table and not actually touching it is less obvious. Of course more geometry means slower calculations.

So it's a balancing act between collision radius, density of geometry in the cloth object and speed of calculation time.

If you know where your sharp corners are, increase point density in those areas for better collision.

All the packages I've tried do this, maya and cinema 4d, so LW's in no way alone in this, and I've found LW can even do things these packages can't because of the way LW works. On the other hand, syflex seems really optimised in it's collision calculations so it can afford much more complex meshes and thus get better collisions. LW's systems could probably use an overhaul and indeed, it says in the 8.5 and 9 docs that dynamics are getting an update to make them faster and more accurate.


More Dynamic Dynamics

Faster Loading of Dynamics Scene Files
Redesigned Dynamics User Interface
Better Workflow
Improved Solving Precision

Improvements in dynamics loading and solving, and cleaner workflows in the dynamics user interface makes dynamics more attractive and easier to use. Higher precision in solver engines allow for better results right out of the box, and the redesigned user interface makes things easier to find and implement. This allows for greater experimentation to get the results that you want.

Surrealist.
09-12-2005, 01:23 PM
Thanks, dodgy, and yes, I think part of my new found criticizm of the dynamics - along with working with it again - stemed from that doc.

But I am glad to see you have it figured out and a big thank you for the tips. It is going to be a great help when I roll up the shirt sleaves, lock myself in a padded room again and go at the dynamics. :bangwall:

However, this time I shall be smater and leave off the straight jacket - much easier to access the keyboard and mouse. :)

mTp,

No worries mate, just growing pains, you know, just trying to get this thing figured out to some workable degree. Thanks for taking the time to mess with it. Maybe with dodgy's tips we can get some progress, eh?

Thanks and if anyone has any more tips, they'd be much appreciated.

MonroePoteet
09-12-2005, 02:57 PM
Dodgy: Thanks for the hints. I dunno, though. My test setup sure seemed simple to me, and I think indicates substantially more problems than just point / edge interpolation. It almost appears as if the collision detection is being done in the wrong local coordinate system, but I gave up before really getting a clear idea of what it's behavior is. I'll try it again, and maybe post a sample scene file when that system becomes available.

Surrealist: As you say, stock up on "sedatives" and try it again at some point.

mTp

MonroePoteet
09-12-2005, 05:17 PM
Dodgy: You're exactly right! Thanks! Your explanation of "cloth point intersects collision polygon" explains a lot!

What I thought were more serious problems were actually the cascading effect of stretchable cloth. Viewing my test scenes with the mindset of "cloth point intersects collision polygon" makes it clear what's happening:

For the Cloth_Collision_BounceTest_Gravity scene:

1) a cloth point makes it past the edge of the collision object
2) the stretch and viscosity cloth parameters allow that point to pull *another* point past the collision object that previous collided
3) repeat steps 1 and 2 until cloth can't stretch anymore

Since I was using a thin pancake as a collision object, the points which got past it can go underneath, dragging the cloth polygon through the pancake as the points on the top of the pancake stretch/rebound, etc. It makes the cascading effect look really bad when the cloth is a third of the way into the pancake.

My misunderstanding of the local coordinate system had to do with the "radius/level" setting. I now think of this as the "virtual radius" of each cloth point. So, I think collision detection constructs a "virtual minisphere" around each cloth point based upon the "radius/level" setting to determines if it intersects a collision polygon.

The real issue seems to be gravity or other movement which allows points to "get past" the collision object polygons before being stopped. Instead of using the "virtual minisphere" approach, the collision detection should use a ray from the previous point location to the current point location to determine if and where it intersects the collision polygon, but it doesn't seem to do so.

Since raytracing using a similar technology to determine ray/polygon intersection, it seems feasible to do collision detection this way. Might be slower, but at least as an option for exact collision detection.

A simple example is using gravity on the cloth object with a low Bounce/Bind power on the collision object, or "stick" mode collision. I've attached a couple of scenes where the cloth object "soaks through" the collision object. I understand why increasing the radius of the "virtual minisphere" around cloth points can prevent this.

It seems that *any* force can cause the same issue. For example, moving the cloth object past the collision object fast enough with keyframes makes the collision object totally invisible. The previous-frame ray would fix this.

Anyway, probably more explanation than necessary. At least now I know what's going on.

Thanks again for that key bit of information!

mTp

Dodgy
09-12-2005, 06:29 PM
Yes, that is pretty much it. Even if things are complex enough, inaccuracies in the collision calculation can lead to vibrations and points being pulled through your collision object. Altering the Resolution setting (in the etc tab in clothfx) can help with this, but again, the smaller the resolution, the slower the calculation. I'm only guessing, but I think it influences how far along a ray steps to check a collision. It also has other side effects as well though I think, I think it might cause unneccesary vibration. Certainly in Hardfx, it influences collision accuracy, but also the threshold at which things come to a stop when you use 'Stop by stabilizer'. Unfortunately, as you increase the collision accuracy, the less things are likely to Stop by stabilizer. I've asked that these two things be set separately, but hopefully the increased accuracy of the new dynamics will go some way to fixing this.

Glad I could be of help.

Dodgy
09-12-2005, 06:48 PM
Something else to bear in mind is that using metalink is very useful.

For a simple cloth I would subdivide the cloth to the resolution I think it should be then set subdivisions to last, so that the deformations become smoothed out after the cloth fx.

For more complex objects, I would set the dynamic object to have subdivision to first, then I can alter the subdivision setting in layout rather than subdividing in modeler, then parent the complex object to that and use metalink. That way you can more readily alter the subdivisions depending on how well the collision is working.

(also you'd be able to alter your complex model and not have to recalculate should the number of points change)

Surrealist.
09-12-2005, 07:18 PM
The real issue seems to be gravity or other movement which allows points to "get past" the collision object polygons before being stopped.

OK, OK, Wow. I can't tell you how grateful I am for you guys to have taken to time out to help. And mTp to have explored this. This is probably the most straight forward and informative stuff I have ever seen on cloth or on dynamics in general.

I can usually be scientific about things and get to the bottom of it, but I knew I was licked on this one. Just didn't have the aptitude. This data is going to go far.

Man. OK. I am going to check out those scenes and learn. Thanks mtp!

Dodgy, I thought about fx linker but thought perhaps it would be less accurate on the collisions. I'll experiment with that too. Thanks. :)

silviotoledo
09-18-2005, 08:13 PM
Hey guys, I tried several times to get sucess with cloth simulation on lightwave 8.3 but it's really terrible. Everytime the cloth pass throughout the colision object.

It was better using Motion Designer. Did someone get a good result?

Surrealist.
09-19-2005, 02:08 AM
No I have not come back to the cloth yet. I plan to do some very sceintific testing with it. But I think if you follow dodgy's tips and mtp's points you'll finally have some sucess. I agree it is not the best but with a little understanding it should become workable.

LightFreeze
09-19-2005, 01:09 PM
Hey guys I`ve been working on a different approach to the collision problem, go have a look, see what you think?

Fast ClothFX (http://www.spinquad.com/forums/showthread.php?t=8404)

Dodgy
09-19-2005, 03:29 PM
I'd actually been thinking about this approach myself, and thinking about writing a plugin to automate this procedure, select your bones, scale nulls to fit each one and add the collision plugin. This would only be aproximate, but it might speed things up a bit...

LightFreeze
09-19-2005, 03:42 PM
That would be good, another option would be if you could save the nulls with the rig or something so that you could reuse them

Surrealist.
09-19-2005, 03:46 PM
That was a cool idea. I think one of my first ideas was to use the nulls and did not even think to scale them.

Bushmsn
09-19-2005, 09:36 PM
Have you set your radius/level up? also I use object-subdiv

FranK10
09-20-2005, 03:58 AM
Yes Dodgy, please make this plug!

It'll be really interesting and useful. Maybe also the only usable approach with the current implementation of Cloth-collision.

Dodgy
09-20-2005, 05:19 PM
I would disagree about it being the only useful approach, but anyway, the plugin is up, check my web page. Obviously the placement of the spheres is only an approximation, but it's a good start.

LightFreeze
09-21-2005, 01:53 AM
thanks for that Dodgy like you say its a good start :thumbsup:

another idea which would be useful would be a script that copys the collision settings from the first selected to the rest of the selected, you can have four or five nulls make up a limb and to start tweaking the settings can be a pain