PDA

View Full Version : nCloth precision changing result of simulation?


Als
04-02-2007, 03:21 AM
Hi!
I already have nice animation cashed, but then I noticed there is a slight jerk in one part of the cloth, which is just about enough to stop me from rendering it.
I'm thinking about redoing this part, so I wanted to give more precision in order to avoid this.
So I've set the values to the following:

setAttr "nucleus1.maxCollisionIterations" 18;
setAttr "nucleus1.subSteps" 8;

now the simulation looks quite different, like I added more force to it, so the wind is blowing stronger then in previous version when values were default.
I hope someone had time to experiment on this issue?

Thanks


Als

Duncan
04-02-2007, 04:22 PM
There were some problems with either windspeed normalization over substeps or drag intensity(since fixed, but no eta on when available). You could try just increasing the collision and self collision iterations, keeping the substeps the same. Or you could compensate by lowering the wind speed or air density.

Duncan

Als
04-02-2007, 07:44 PM
Hi Duncan,
thank a lot.
I'm working on a curtain animation. I have the rigth move, but not enough detail.
Also I'm thinking to change constrains from transform to sliding.
Clot becomes a bit unstable after I delete constrains and make new ones.
Also when combined with any other force/field, sliding want's to get loose and start hiting itself ("scaling down", even the rest scale is 1).
What is the best way to stabilize it?

I also need more detail, so need to increase wrinke a lot, and still not fall apart.
If I let's say multiply number of input verices, this means that mass of the whole curtain has doubled?
Also when wrinkling cloth, is it better to disconnect the map, before simulation?
Relaxing cloth makes it again too relaxed, even if I do it with real small steps. What is the best way to keep cloth in "vacuum" until it's relaxed enough to start simulation? Or should I just boost some of the collision and self collision.
Once I finish, I promise I'll make the curtain tutorial ;)

Thanks


Al

Duncan
04-02-2007, 08:45 PM
If your cloth is unstable with a constraint it suggests that the constraint is fighting the stretch or bend resistance of the cloth. If you are doing a curtain you should not constrain the entire top row of vertices, but instead every 4th one or so. Otherwise when you try and close the curtain it will attempt to compress the cloth... it is constrained such that it can't move in a natural fashion.

I would suggest initially modelling the curtain slightly closed( like a sine wave shape ) such that the number of vertices nicely fits the shape. Constrain the points that are at the middle of this sine wave along the top. A transform constraint will work fine as long as you don't want to move it too fast( transform constraint positions are not interpolated during substeps.. a bug). For faster motions you may wish instead to constrain to a long skinny plane object along the top. To open and close the curtain simply scale the transform constraint node( or the plane if you constrained to an object ). Given that the rest shape is modelled there is no need for a wrinkle map. Also note that the curtain should not have very much bend resistance or it won't close and open nicely. If you want the curtain to start fully open then increase the constraint scale while simulating to open then set initial state on the cloth.

I suppose a further refinement would be to instead use a slide on surface constraint with a VERY skinny plane along the top, thus creating a rail where the pins can slide. Make fricton low or zero on the constraint and also turn off localCollide. Again one should only constrain the center points of the sine wave. One can transform constrain a cv along one edge to "pull" the curtain and animate the position of this to open and close the curtain. Self collision quality is important for this, because it is what causes the curtain to close.. you probably need full surface self collision with the width carefully adjusted. The advantage to this is that the curtain folds would pile up as it closes in a more natural fashion( although it depends on the mechanics of the curtain being simulated ).

An alternative to using center points on the sine wave is to use the outer points. This may seem to insure the shape of the ripple more, but care needs to be taken: as the curtain extends the constraint now needs to be scaled in two axis, not just one. The amplitude of the ripple is lower when the curtain is open, so that the cloth does not stretch. It is tricky to get this scaling just right, and thus is better in general to use the center points( and more like a real curtain ).


Duncan

Als
04-02-2007, 10:01 PM
WoW!

Thanks! That's now reading for next 3 days!!! I wish I mentioned it sooner...
Thanks a million!

The reason to make a wrinkle is because I really need very high detail curtain, because they are quit close, and long, so which means they are very very small sinusoid at the top, and as they go down the amplitude is growing. I wanted to achive this with texture, since it seamed good plan as any, and it looks quite amazing, but the number of polygons needed is a bit, well, intense... I was using every third point, but I would get some sort of a force anyways.
Must be some local collide.
Well, client already aproved animation, but I might make few more curtains ;)

Thanks


Als

Duncan
04-02-2007, 10:50 PM
I just tried out the curtain on rails technique I described( using a slide on surface constraint ). I think the problem you were having was likely the "localCollide" attribute on the constraint, which needs to be turned off. A second problem I had is that the constraint tends to stick where the cvs hit the rail edge, a bit like a rusty curtain rail, but worse because it forces the cloth to stretch when it catches. A solution was to do two slide on surface constraints to two planes orthonormal to each other. In this way the constrained points can't touch the plane edges but must stay in the middle. I also make the constrain rest length zero to snap the points to the planes(my modelling was a little sloppy). Once I did this I actually needed a little friction on the constraint to make it more realistic.

I've attached a file with the described setup. It also has an animated constraint to pull the curtain and one to anchor the end against the wall.

Duncan

Als
04-03-2007, 02:12 AM
:thumbsup: :thumbsup: :thumbsup:

:bounce::bounce::bounce:

:applause:


Thanks a lot!


Als


Yeah, I know...

:shrug:

waltz
04-03-2007, 06:54 AM
WoW

this is a great thread
keep the goood work going guys
thanks a ton

Als
04-03-2007, 06:38 PM
Ok, one more thing I finally figured out, even it probably is somewhere in manuals...

If you have nCloth constraint on some surface, you can add membership to it.
(first do: ncloth -> display input mesh)
For example select points on surface, then add selection vertices on cloth object, and then select dynamic constraint node, and select command add constrains -> add membership.

Now, comes the questions:

A) Is there a way to connect/disconnect them in relationship editor?
B) Is it possible there is somewhere hidden script, or some of the tools which are there which would help to make a mel script, which would do the following:

if you select option -> constrain method -> maximum distance. Then press button (execute mel), and changes it back to component order, but now the members selected are the same as maximum distance?

C) Would it make sense to do this mel script with pointOnSurface info or equivalent, to get to this membership regruping automaticaly?

Reason for this is for example (regarding the curtain scene) if you already have input history on cloth which still works, but now I want to improve(raise) tesselation on nurbsTo poly node, if I do that the membership points on cloth will move to totally different points.

Or is there a way I'm not aware to change tesselation, or let's say create poly with history tools, to keep existing vertices with the same numbers(id) ?


Thanks


Als

Duncan
04-03-2007, 10:58 PM
First, as you noted, it is pretty easy to edit constraint membership using the add/remove/replace members menu items. There are some ways to make the constraints more independant of the mesh topology, but they generally add some complexity.

The simplest is to constraint all components or all boundary components instead of a subset of points. If you constraint all points on a surface it automatically makes the nComponent.elements = "ALL". Changing the resolution of the mesh will still have it constrain all the points. If you want instead to constraint all border points you can set the nComponent.elements to "Borders". After changing the resolution it will still constrain all borders.

The "ALL or Border" selection on the nComponent can be further restricted by texturing the strength Map attribute. One can "paint properties by texture map" or use any 2d procedural texture. Where the map is black the constraint will have no effect. Note that "painting by VERTEX map" will not often work in this case, as the vertex mapping array may not map well to the changed topology. A UV texture does not have this problem, but it does require that you have well defined UVs on your surface.

Another way of restricting the connections is to use the maxDistance and connection density settings on the constraint, although this does not yet work with point to surface constraints ( it does work with point to face constraints, however )

Also when you create the constraint there is an option to use sets. This maintains the component indices on set nodes instead of as an array on the nComponent node. This setup adds a fair bit of complexity, but for some setups can potentially allows changes to topology without needing to reassign the constraint links. But in practice I've found that there are few cases where it is really useful, and the correct translation of the sets is not consistently handled by the different construction histories. For it to work at all the new construction history has to occur downstream of the set connection to the input mesh, but before the nCloth node. As the set definition is passed through the construction history, for example a smooth node, the set is modifed to preserve as much as it can. The constraint then gets this modified set of components.

Duncan

CGTalk Moderation
04-03-2007, 10:58 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.