PDA

View Full Version : Dynamic Chains, and lots of em


hellspawned
03-18-2010, 11:21 PM
Hey!

I just started working on an old laid-off project, a chaos space marine commander. Once I've done all the detailing, the plan is to make it fully animated.

So, as you see in the picture below, one of the shoulderpads has these chains on it, and they will need to move in a dynamic way.

I tried, just to make sure, and I was pretty sure it wouldn't work, to just make the whole thing into one active rigid body sim, and it nearly lagged stuck on my computer (which is pretty beefed up). Clearly it's too heavy for any home computer to calculate, at least in one big chunk, with default settings.

So my question is, what's the best way to go about this? How do i streamline the simulation? Just to clarify, I'm nearly a complete novice on dynamic simulation, so thorough tutorials or thorough advice would be appreciated!

http://img411.imageshack.us/img411/9441/chaosshoulderpads.jpg (http://img411.imageshack.us/i/chaosshoulderpads.jpg/)

Aikiman
03-18-2010, 11:40 PM
Have you tried nCloth?

hellspawned
03-19-2010, 12:28 AM
And here comes the part where my novice knowledge of dynamics in general requires "Thorough Answers".

To answer your question directly: Yes, I've fiddled with it, made tablecloths and a flags. But I'm guessing you don't mean "Have i tried nCloth" in the literal sense. So please, elaborate what you mean.

As i said in my original post, the only thing I've tried with this project is to make every link an active rigid body, and that worked out as described in the thread start - Not all that good.

I'm sure, in theory, it would work splendidly if I had a whole bunch of computers just crunching the dynamics simulation, but i don't. Single-computer solutions please :P

FluidEdge
03-19-2010, 12:41 AM
I'd go with either a better rigid body engine - PhysX or Bullet or drive this with a hair curve and an IK chain.

Aikiman
03-19-2010, 12:50 AM
I'd go with either a better rigid body engine - PhysX or Bullet or drive this with a hair curve and an IK chain.

I just had a go with nCloth and its not much better with sim times, Id go with another solver, maybe even dynamica.
http://forums.cgsociety.org/showthread.php?f=86&t=675357&highlight=dynamica

I cant see this working with a hair curve and IK chain, what about collisions?

FluidEdge
03-19-2010, 12:57 AM
carefully placed collide spheres ;)

No i think the dynamica/bullet solver is the way to go here. It should breeze through those chains, they're really pretty simple. Maya's own solver just hates things like that - too many interpenetrations. It's a creaky old solver now. Autodesk should just licence Bullet or PhysX for 2011/2012 imo.

Aikiman
03-19-2010, 01:01 AM
carefully placed collide spheres ;)


Sounds like a lot of hard work to me.

HowardM
03-19-2010, 01:08 AM
ncloth isnt too bad for this, but theres always other ways...

http://forums.cgsociety.org/showthread.php?t=848517

FluidEdge
03-19-2010, 01:16 AM
Sounds like a lot of hard work to me.

When have dynamics ever been easy! :banghead: :cool:

Aikiman
03-19-2010, 01:39 AM
When have dynamics ever been easy! :banghead: :cool:

The positive is at least the only way is up for Maya RB cause it cant go any lower :shrug:

Duncan
03-19-2010, 02:13 AM
The following file shows a method for an nCloth chain that is relatively efficient and captures the correct behavior of chain links.
http://area.autodesk.com/userdata/fckdata/200/file/nClothChain.zip

Basically the technique is to create links as simple cube shapes with two missing faces( each link has only 4 faces ). The links are combined into two meshes... one for odd links the other for even, and the result made into two nCloth meshes. Note that it is important before making nCloth to select the faces and to createUV: automatic projection so each vertex has a unique UV... the last step requires this even though one will not render the cloth mesh. The cloth needs high stretch and bend resistance values as well as higher substeps. The collision thickness should be set to about the thickness of the chain. The last step is to attach your chain links, which may have as high a poly count as is desired, to the simple nCloth links. First get the parentToSurface script I wrote and put in your scripts diretory:
http://area.autodesk.com/blogs/duncan/parent_to_surface_script

Position these links in the correct position, select them followed by the nCloth and type:
parentToSurface

Do this for each of the 2 cloth nodes.

They should now follow the motion of the nCloth, which may then be hidden.

The same technique could be used for the central plate object, which could be a single nCloth face that has component to component constraints with the chain nCloths.

Use bend/stretch/compression resistance for everything and avoid the nCloth rigidity.

Duncan

Duncan
03-19-2010, 03:01 AM
For a faster chain with an easier workflow: Create a long and skinny plane with about the same number of polys as the number of chain links then make it nCloth and use parentToSurface to attach your chain link objects to the cloth strip. The cloth settings should have high stretch resistance, little or zero bend resistance, a thick collision width and low compression resistance. If the initial position of the cloth has the links not fully taught then one can increase the rest length scale on the cloth a little. Increase mass for minimal drag effect and make stretchDamp zero so the chain is bouncy.

http://area.autodesk.com/userdata/fckdata/200/file/nClothChainFast.zip

This is not as accurate as the first method but does not require as high substeps and collide iterations. One can do a lot of chains with this method and still keep things interactive. I turned off crosslinks on the cloth as well so that the cloth could shear. (making the cloth skinnier would have done much the same thing, but then it could twist more easily as well, which might not be desired)

Duncan

Aikiman
03-19-2010, 03:38 AM
Is the UV layout for applying the rivets?

Duncan
03-19-2010, 03:46 AM
Yes the follicle nodes attach to a specific uv location on a surface. The parentToSurface script won't work well if a surface has non-unique uvs. It is kind-of a pain, but an advantage is that one can slide the follicles over the surface by animating the follicle uv. The other nice thing is that one can change the topology of the mesh and the follicles will still stay in the same position.

Duncan

Aikiman
03-19-2010, 03:50 AM
Duncan why do we have to use proxy objects while doing RB simulations with nCloth, is it because nCloth is not designed for RB sims?

Duncan
03-19-2010, 04:12 AM
The output of nCloth is animated vertices, not animated translate/rotate as is the case with a rigid system. The above workflow is basically making simple cloth objects "relatively stiff" then attaching rigid meshs to to the cloth( like buttons on a shirt ). With cloth one can make it stiff easily only for very simple meshes. The time to compute cloth stiffness goes up exponentially with mesh resolution, so it helps to keep the cloth as simple as possible. Usually this makes the the cloth simpler than the model we wish to render and the cloth will still deform a little thus the need in this case to attach a rigid mesh to the cloth surface and hide the cloth.

There is a rigidity attribute on the cloth that is essentially a rigid body solver inside the cloth solution, but it is not very practical for things like chains, as one would need too make each link a separate cloth object and I think it might get slow and have poor collision behavior( although I've not tried it ). The rigidity attribute can be useful in some cases, but it is not a substitute for a rigid body system, and often it works better if one keeps the mesh simple and relies on bend/stretch/compression resistance.

Duncan

Aikiman
03-19-2010, 04:43 AM
I did try using the concrete preset on low res poly links but like you said, I had to make each one an nCloth object and it wasnt very practical. Collisions worked okay with substeps close to 20 but I couldnt achieve free flowing rotations between the links as if friction was too high, but even with low friction values the problem still persisted.
Your method is far more efficient.

Is a RB solver something you guys will be working on in the future?

HowardM
03-19-2010, 12:40 PM
awesome D, even better than Johns idea ;)

Fridi
08-03-2010, 11:12 AM
Hi Duncan,
I had a look at your nClothChainFast-solution and i think it is very smart, thanks!
One thing I have to solve though is an issue I only encounter when I rebuild your scene with a different chain-mesh (shorter and less follicles):

Compared to your nClothChainFast.ma scene my follicles freak out during fast and jerky chain movements. It seems as if they can't keep track of the right normal direction.

I created them like you wrote, using your script after having created a clean mesh with clean UVs. Are there any tricks you can share to make them more "stable" during heavy mesh movement?

Thanks in advance,
Fridi

Duncan
08-04-2010, 02:00 AM
Compared to your nClothChainFast.ma scene my follicles freak out during fast and jerky chain movements. It seems as if they can't keep track of the right normal direction.


I'm not entirely sure why, but it should fix the problem if you add divisions to the output cloth mesh, or instead you could smooth it. It might have something to do with the way triangle coords or normals are interpolated when the triangle is stretched.

Duncan

tfahey1
09-13-2010, 08:29 PM
Hi Duncan,

How could I apply your fast chain approach to a rope, basically a cylinder, rather than chain links? Thanks.


Tim

Duncan
09-13-2010, 09:36 PM
A rope is easier. One need not handle the free compression of chain links or instancing links along the strip.


Just create a long skinny poly plane with subdivisions along its length (a strip of square quads), then make it nCloth, constrain and simulate as desired. You might not want any bend resistance on the cloth. To render a rope shape, you have a few options, although a simple technique is to extrude the output cloth(with history) to make a square tube, then smooth the result to make it a round tube. The finer detail on the rope could be handled with bump or displacement maps if needed. Another approach might be to paint a pfx stroke along the strip and convert to poly( or to nurbs curve and then model based on that ).


Duncan

tfahey1
09-13-2010, 10:51 PM
Thanks Duncan,

One problem...it's collapsing at the end of the cube, seems to not keep its original volume. I have it constrained at one end and that end is keeping its volume but the opposite end collapses and flattens out. Is there a way to fix this?

Also, I'll let you know what I'm shooting for, if it may make a difference. I'm looking for the best way to wrap a rope around a spool. Basically the spool, perpendicular to the rope, will be rotating, winding up the rope. The scenerio is the rope will manufactured by a machine and then wrapping on the spool. So, the spool will pulling the rope out almost. I hope that makes sense.

Thanks

Tim

Duncan
09-13-2010, 11:14 PM
If I understand you correctly, it sounds like you are simulating on the extruded plane, rather than doing it downstream of the cloth. You want to simulate the flat strip, then extrude the output cloth mesh( not the input one) along the surface normals to give it thickness. (in terms of collisions you can use the thickness on the cloth node)

Duncan

Duncan
09-13-2010, 11:19 PM
The spool animation should be as simple as:
1. create nCloth strip
2. make spool a passive collider
3. do point to surface constraint of the 2 vertices at the end of the cloth strip to the spool
4. keyframe the spool rotation and playback.

If you have stretching or collision problems, increase substeps and stretch resistance.

Duncan

tfahey1
09-13-2010, 11:40 PM
I think you're right, I didn't extrude the correct mesh initially. I went back and did the following...created a plane 1 by 20 with 20 subdivisions. Made that nCloth. Created cylinder and made that a passive collider. Constrained the 2 closest vertices to the cylinder using point to surface (I used transform before and that seemed to work too, would that matter?) Then ran playback, and it worked good. cloth wrapped around cylinder. Then I selected outputCloth1 and extruded that. Ran playback and seem to have the same problem, it keeps volume on top of the spool but as it drapes over the edges it flattens.

Thanks for the help, Duncan. Obviously, I'm a dynamics novice so please bear with me. I really appreciate the assistance.

Tim

Duncan
09-14-2010, 01:49 AM
I think you are hitting a bug where the normals used by the extrude are not properly updated for the deformed cloth mesh. You can work around this by doing normals:softenEdge on the mesh before the extrude. This insures that the extrude has computed normals to work with.

Duncan

tfahey1
09-14-2010, 02:09 PM
Hey Duncan,

I did the normals:softenEdge and I'm still getting the same results. I'm assuming that should be done to the outputCloth? Any chance I could send you a personal message with a file attached for you to take a look at? At the moment I don't have access to a server to be able to share a link here for you to download.

Tim

tfahey1@yahoo.com

Duncan
09-14-2010, 05:58 PM
Perhaps you got the ordering of the nodes wrong. Select your object and open hypergraph:connections. You should see:

outputCloth -> polySoftEdge -> polyExtrudeFace


The extrudeFace node should be using the localTranslate Z value.

Duncan

tfahey1
09-14-2010, 07:15 PM
Thanks, that seemed to work. I think the problem was that I was that I was clicking the little blue dot and then doing the extrude so extruding on global Y, I guess.

Can you make any suggestions to avoid self pass through as it wraps around the cylinder?

Thanks Duncan!

Duncan
09-14-2010, 08:15 PM
Can you make any suggestions to avoid self pass through as it wraps around the cylinder?

Firstly, adjust the collide thickness to match the thickness of the rope. (set solverDisplay to collision thickness to better see it). If there is interpenetration then increase substeps on the solver node until it fixes things.

The extrude will be from the center of the cloth, so it will not exactly match the cloth position. For an exact match you can select faces on the output cloth mesh and do a transform component along the normal before doing the extrude. (you may still need the soften Edge before doing the transform component) You basically transform one way and extrude the other way. This way the geometry should closely match the collision boundary of the cloth.

Duncan

HowardM
09-14-2010, 11:16 PM
lol or just tell him to wrap a modeled rope that fits perfectly centered ;)

Duncan
09-15-2010, 12:21 AM
Yeah, that is definitely easier when you want to model the rope, but for simple tubes I find this workflow is pretty easy( it sounds perhaps more complicated than it is).

Duncan

tfahey1
09-15-2010, 06:02 PM
Is there any way to change the proportions of the collide boundary? As I move the slider, the boundary expands both height and width, is there a way to adjust them individually?

And Collision Thickness only refers to collisions with the passive collider and the Self Collision Thickness is only collisions with itself? Is that correct?

Thanks, I appreciate the help!

@Howard...It's not a rope, basically plastic tubing.

Duncan
09-15-2010, 07:50 PM
Is there any way to change the proportions of the collide boundary? As I move the slider, the boundary expands both height and width, is there a way to adjust them individually?

There isn't. The thickness is a radius of collision from the surface( in all directions ).

The resulting collision thickness is of course a combination of the values on the two objects colliding.

Self collide width scale is defined relative to the collision thickness, so for a value of 1.0 it would be the same. The self collision thickness is used for collision between components of an nCloth (or nParticle) object. We limit the thickness on a per collision pair basis to be no greater than the distance these pairs are separated at the start of the simulation. This keeps a thick self collision from exploding apart at the start frame. An interesting side effect is that one can use really high self collision width on a cloth (vertex self collisions for speed) and it can behave like a solid or thick substance instead of a thin shell.

Duncan

CGTalk Moderation
09-15-2010, 07:50 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.