CGTalk > Software Specific Forums > Autodesk Maya > Maya Dynamics
To minimize the ads you see on this page create a CGTalk account and log in HERE
reply share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 03-12-2013, 05:14 PM   #1
FyreFlare
Frequenter
portfolio
FyreFlare
United%2BKingdom
 
Join Date: Nov 2012
Posts: 111
Frayed Wallpaper Peeling Using nCloth, help

Hi guys, im trying to recreate an effect using ncloth, but im kinda stuggling with it.
Heres the link: http://www.youtube.com/watch?v=_ELnEjFR81M
I've tried it two ways so far; using cut face tool to pre shatter the plane and have tried with animated maps to hold verts in place before the field arrives, but have had more success using Soup attribute transfer for glue strength per vertex. However i dont get the frayed edges this way.

The second way is using tearable surface constraint, however im applying it to the whole plane and it seems like there is a lot less control than pre shattering. And im struggling to immitate the fraying in the video, not sure what kind topology i should be using on the plane.
I can post results of either of these methods if it helps to see.
Thanks

Does anyone have any thoughts on how to achieve this effect?
 
Old 03-12-2013, 11:22 PM   #2
Duncan
Expert
 
Duncan's Avatar
Duncan Brinsmead
Principal Scientist
Autodesk
Canada
 
Join Date: Jun 2002
Posts: 2,978
I suppose it depends on exactly what you are after, but a simple technique would be to have no forces or gravity acting on a pre-shattered cloth then animate the position of a volume axis field so it encompasses the object. So for example it might be an upward force inside the volume axis field and you just move it so it intersects the parts you want to peel off.

The shattering could be done by selecting all the edges you wish to tear along then doing doing detach component before making the mesh cloth.

If you wanted to make it like something sticking to a surface that is peeling off then you could perhaps additionally collide with the original non-shattered mesh, making it a passive collider and on the nRigid node set the forceField to create a slight clinging force near the surface (keep fieldDistance small).



Another approach is to lock the cloth using inputAttract and then animate the inputAttract per vertex. This is a little tricky to do, but the following works:

1. Create a volumeAxis field affecting the cloth

2. Set inputAttract to 1.5 and set inputAttractMapType to Per-Vertex

3. Create a custom array attribute on the cloth (lets call it inputA):

addAttr -ln "inputA" -dt doubleArray nClothShape1;
setAttr -e-keyable true nClothShape1.inputA;

4. Set up a particle creation and runtime expression for the nCloth

dynExpression -s "inputA = 1;" -c nClothShape1;
dynExpression -s "if( inputForce[0] != 0 ){\n\tinputA = 0;\n}" -rbd nClothShape1;

One can use particle expressions in a limited fashion with nCloth, because it is derived from the particle class. These expressions set inputA to 1 at the start frame and zero when the field strength is not zero.

5. With a regular non-particle expression copy the array inputA to the inputAttractPerVertex array. We do this by connecting and disconnecting the attributes. We can't simply leave it connected or directly set the per vertex array inside the particle expression, as this leads to a dependency graph loop that blocks evaluation of the cloth.

expression -s "connectAttr nClothShape1.inputA nClothShape1.inputAttractPerVertex;\ndisconnectAtt r nClothShape1.inputA nClothShape1.inputAttractPerVertex;" -o pSphere1 -ae 1 -uc all ;

Once this is done the cloth will be locked to the input mesh position(even if it animates) until the volume axis field overlaps it, after which it is free to move with forces.
I've attached a simple scene showing this technique.

If you want to have smooth normals you could do a merge vertex followed by smooth normals on the output cloth mesh. (that's basically what the tearable constraint does)
Attached Files
File Type: zip clothInputAttractExpressionControl.zip (8.3 KB, 112 views)
 
Old 03-15-2013, 12:48 PM   #3
FyreFlare
Frequenter
portfolio
FyreFlare
United%2BKingdom
 
Join Date: Nov 2012
Posts: 111
Hi Duncan thanks for the response, Iv'e attempted to re-create your setup, but im having some trouble, i ran the lines you sent and everything connects giving me the two expressions
After running 4:
Code:
if( nClothShape1.inputForce[0] != 0 ){ nClothShape1.inputA = 0; }


And after running 5(I Changed the pSphere1 to to pPlane1):


Code:
connectAttr nClothShape1.inputA nClothShape1.inputAttractPerVertex; disconnectAtt r nClothShape1.inputA nClothShape1.inputAttractPerVertex;


However when simulating i get an execution error: 'nClothShape1.inputA' is already connected to 'nClothShape1.inputAttractPerVertex'.

I tried deleting the expressions on the scene you sent and re-running the code but i still get the execution error. I understand what the expressions are doing, but not why im getting this error, am i missing something?
 
Old 03-15-2013, 01:22 PM   #4
FyreFlare
Frequenter
portfolio
FyreFlare
United%2BKingdom
 
Join Date: Nov 2012
Posts: 111
Ha! there was an r offest from the 'disconnectAtt r' - syntax always the case!
So whats the best way of giving the ncloth that very ragged frayed look? I cant use terable surface constraint can i? - because all the pieces are shattered to begin with?
 
Old 03-15-2013, 03:18 PM   #5
Duncan
Expert
 
Duncan's Avatar
Duncan Brinsmead
Principal Scientist
Autodesk
Canada
 
Join Date: Jun 2002
Posts: 2,978
To make it more frayed: instead of detaching all vertices like my example you should select just the edges where you want it to tear and detach them. If necessary create more edges (subdivide faces along tear boundary ) if you need a finer tear.
 
Old 03-15-2013, 03:32 PM   #6
FyreFlare
Frequenter
portfolio
FyreFlare
United%2BKingdom
 
Join Date: Nov 2012
Posts: 111
I think thats what im currently doing, im using cut face to define where i want shatters to occur then selecting all edges and detaching, then smoothing to allow the mesh to curl and bend. But the edges that i have cut and detatched are just straight edges, how do i specify those edges for tearing when they are already detatched?
 
Old 03-15-2013, 05:53 PM   #7
Duncan
Expert
 
Duncan's Avatar
Duncan Brinsmead
Principal Scientist
Autodesk
Canada
 
Join Date: Jun 2002
Posts: 2,978
nCloth uses the mesh topology for building its links and connections. Anywhere the mesh is detached along an edge is automatically split if you then make it nCloth... you must either do the detach before making it nCloth, or you must do it on the nCloth input( not output ) mesh.
 
Old 03-15-2013, 09:06 PM   #8
HowardM
Digital Ho
 
HowardM's Avatar
--------------------->
FX TD
a large dark room . . . . ... . .. ...with bright monitors
United Kingdom
 
Join Date: Mar 2002
Posts: 3,068
Quote:
Originally Posted by Duncan
I suppose it depends on exactly what you are after, but a simple technique would be to have no forces or gravity acting on a pre-shattered cloth then animate the position of a volume axis field so it encompasses the object. So for example it might be an upward force inside the volume axis field and you just move it so it intersects the parts you want to peel off.

The shattering could be done by selecting all the edges you wish to tear along then doing doing detach component before making the mesh cloth.

If you wanted to make it like something sticking to a surface that is peeling off then you could perhaps additionally collide with the original non-shattered mesh, making it a passive collider and on the nRigid node set the forceField to create a slight clinging force near the surface (keep fieldDistance small).



Another approach is to lock the cloth using inputAttract and then animate the inputAttract per vertex. This is a little tricky to do, but the following works:

1. Create a volumeAxis field affecting the cloth

2. Set inputAttract to 1.5 and set inputAttractMapType to Per-Vertex

3. Create a custom array attribute on the cloth (lets call it inputA):

addAttr -ln "inputA" -dt doubleArray nClothShape1;
setAttr -e-keyable true nClothShape1.inputA;

4. Set up a particle creation and runtime expression for the nCloth

dynExpression -s "inputA = 1;" -c nClothShape1;
dynExpression -s "if( inputForce[0] != 0 ){\n\tinputA = 0;\n}" -rbd nClothShape1;

One can use particle expressions in a limited fashion with nCloth, because it is derived from the particle class. These expressions set inputA to 1 at the start frame and zero when the field strength is not zero.

5. With a regular non-particle expression copy the array inputA to the inputAttractPerVertex array. We do this by connecting and disconnecting the attributes. We can't simply leave it connected or directly set the per vertex array inside the particle expression, as this leads to a dependency graph loop that blocks evaluation of the cloth.

expression -s "connectAttr nClothShape1.inputA nClothShape1.inputAttractPerVertex;\ndisconnectAtt r nClothShape1.inputA nClothShape1.inputAttractPerVertex;" -o pSphere1 -ae 1 -uc all ;

Once this is done the cloth will be locked to the input mesh position(even if it animates) until the volume axis field overlaps it, after which it is free to move with forces.
I've attached a simple scene showing this technique.

If you want to have smooth normals you could do a merge vertex followed by smooth normals on the output cloth mesh. (that's basically what the tearable constraint does)


Dagnabit! Why didnt you post this years ago?!

Cheers for it now
__________________

.

Reel - 3DInk.com
Filmography -IMDB
R&D - VIMEO

*please read- cyanbsl.blogspot.com/*
 
Old 03-16-2013, 07:50 AM   #9
-heavy-
made of smoke
 
-heavy-'s Avatar
janko
free for hiring
Berlin, Germany
 
Join Date: Jul 2005
Posts: 258
Quote:
Originally Posted by HowardM
Dagnabit! Why didnt you post this years ago?!

Cheers for it now


Hell Yeah... so right...its a bit like SouP.ing with bounding
object and getting initial Spin and dynamics on the shards...

How would that work when not using input attract but glue strength on
an nComponent Tearable Constraint ? or both of them input attract to bound
to the moving object and tearable glue strength to get nice fractured shards ?

the same procedure but connected to the nComponent gluestrength VertaxMap
Input ?
 
Old 03-18-2013, 10:38 AM   #10
FyreFlare
Frequenter
portfolio
FyreFlare
United%2BKingdom
 
Join Date: Nov 2012
Posts: 111
In that case i would have to create the tearable surface constraint on the input mesh after it has been made in to nCloth? and just forget about using the detatch tool before its nCloth because as you say those edges where it has been detatched are treated as a pre-split surface? is this right?
Would it be a better idea to create tearable surface around the cut edges, and then increase divisions, otherwise specifiying where tearing should occur would be kind of tricky due to all the divisions
 
Old 03-18-2013, 11:31 AM   #11
HowardM
Digital Ho
 
HowardM's Avatar
--------------------->
FX TD
a large dark room . . . . ... . .. ...with bright monitors
United Kingdom
 
Join Date: Mar 2002
Posts: 3,068
Quote:
Originally Posted by flares
In that case i would have to create the tearable surface constraint on the input mesh after it has been made in to nCloth? and just forget about using the detatch tool before its nCloth because as you say those edges where it has been detatched are treated as a pre-split surface? is this right?
Would it be a better idea to create tearable surface around the cut edges, and then increase divisions, otherwise specifiying where tearing should occur would be kind of tricky due to all the divisions


Ungh, Duncan, please removed Terrible Constraint from the arsenal, as we all know its pointless...

Never use it guys, its crap. Better workflow is to manually cut up your mesh or shatter it. Then make it cloth and use Weld Adjacent Borders... read up here, there are plenty of posts on the forum about it and how to do this.

Example - http://vimeo.com/16375110

As for specifying tearing, you can use ramps or textures on Input Mesh or Constraints, along with the method Duncan has shown you here to control what rips and where...
__________________

.

Reel - 3DInk.com
Filmography -IMDB
R&D - VIMEO

*please read- cyanbsl.blogspot.com/*
 
Old 03-18-2013, 02:41 PM   #12
FyreFlare
Frequenter
portfolio
FyreFlare
United%2BKingdom
 
Join Date: Nov 2012
Posts: 111
Having a try with weld adjacent instead. Currently im diving an edge just down the middle, where i want to tear, then im using the brush tool to highlight verts down the subdivided section, and detatching component(not sure if this is a good way of doing this or not). Then turning in to cloth and using weld constraint, and as soon as the simulation starts i get this:Untitled-1.jpg which only seems to happen when i increase the number of divisions.
Not sure why im finding this so tough
Awesome example btw Howard
Attached Images
File Type: jpg Untitled-1.jpg (70.8 KB, 60 views)
 
Old 03-18-2013, 06:50 PM   #13
Duncan
Expert
 
Duncan's Avatar
Duncan Brinsmead
Principal Scientist
Autodesk
Canada
 
Join Date: Jun 2002
Posts: 2,978
If you created the constraint based on selected components then changing the resolution of the underlying mesh will result in different components being connected together. With a weld constraint this will snap those components together, which would explain the problem you are seeing. Just display the input nCloth mesh and reselect the elements you want to be constrained after changing the resolution then do nConstraint: replace members to fix the problem. Or perhaps you could instead constrain based on max distance and set the nComponent to be all border vertices( or edges, if the verts do not align)... in this way you could change the mesh resolution and the constraint would still work OK.
 
Old 03-18-2013, 06:54 PM   #14
Duncan
Expert
 
Duncan's Avatar
Duncan Brinsmead
Principal Scientist
Autodesk
Canada
 
Join Date: Jun 2002
Posts: 2,978
Quote:
Originally Posted by HowardM
Better workflow is to manually cut up your mesh or shatter it.


One can manually cut up the mesh using the tearable constraint by first selecting all edges you wish it to tear on( instead of the full mesh ). It will only shatter the cloth mesh along those edges.

Duncan
 
Old 03-18-2013, 09:16 PM   #15
Duncan
Expert
 
Duncan's Avatar
Duncan Brinsmead
Principal Scientist
Autodesk
Canada
 
Join Date: Jun 2002
Posts: 2,978
Quote:
Originally Posted by flares
... Then turning in to cloth and using weld constraint, and as soon as the simulation starts i get this:Untitled-1.jpg which only seems to happen when i increase the number of divisions.


I just realized that your problem must the be max distance on the constraint... just lower the value. When you increase the resolution the length of edges may go below the max distance value, which causes neighbor edges to get attached (which causes it to clump when it is a weld constraint).

The max distance is set on the high side by default so that border don't need to exactly touch to be welded.
 
reply share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:27 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.