Username
Password
Auto-login
Show my name in the online users list
Not a member?
Please register.
Forgot your password?
(1) October 2008
(2) May 2008
(1) January 2008
(1) November 2007
(2) September 2007
(7) August 2007
(2) July 2007
(1) June 2007
(3) May 2007
(4) April 2007
(8) March 2007
(9) February 2007
nCloth Vertex Editor (mel script)
Posted: Jul 28, 2007 - 05:57 PM
Category: nCloth
Here is a mel script that will allow you to easily edit per vertex nCloth values by selecting vertices and editing values directly with a slider, rather than by using the paint tool.

First put the following mel file in your local scripts directory:
nClothVertexEditor.mel (you'll find this at the bottom)

Startup maya then enter "nClothVertexEditor" into the command line. A small window should appear.
Select vertices on an nCloth then set the desired vertex attribute in the window. The slider will show the current value for those vertices which you can then change. If the selected vertices have different values then the slider will show the average value and a message appears indicating a range of values. If desired one can also randomize the values using the randomization slider.

Drag the string "nClothVertexEditor" onto the shelf so that in future you can simply click on the shelf button to bring up the editor.


Let's experiment on a simple poly plane. Set its subdivisions to about 30x30, make it nCloth, then type :
nClothVertexEditor

Select a couple of vertices, set the attribute to "inputAttract" and the value to 1.0. The cloth should fall except for the selected vertices, which are now attracting to input mesh. This is similar to a transform constraint.
If you wished to have less stretching near these vertices you could either increase the substeps or give the neighboring vertices a small amount of inputAttract.

Select some more points, make the attribute "wrinkle" and edit the slider value to displace the rest position. (First make the bend resistance at least 1 on the nCloth... otherwise one can only see the effect on edge restlength)
Note how with wrinkle selected the slider range goes from -1 to 1. This makes it possible to displace on both sides of the surface. You can select a large block of vertices and increase the randomization to make the surface lumpy. (Depending on the size of your mesh you may need to also adjust the wrinkleMapScale on the nCloth node to set the min/max wrinkle displacement)
The values one can set range from 0-1 for all attributes except wrinkle, which goes from -1 to 1. The per vertex values are multipliers of the same named attributes on the nCloth node. Thus for more stretch resistance per vertex than 1.0 increase the stretchResistance attribute on the nCloth node. Also do not use this a tool for setting the value of ALL vertices on an nCloth. Instead set the attribute mapType to "None" on the nCloth node and set the per cloth, not per vertex attribute.

If desired you can also edit vertices from multiple nCloth and nRigid nodes at once.

NOTE: Currently the randomization can be a bit confusing in that the vertex value slider currently gets reset to the average value for the selected vertices after each edit. With the randomization at a non-zero value the value slider will thus jump to a lower value after one adjusts it. The vertices were set to a spread of values, some lower than the slider value, so the average is thus lower.
In order to post any comments, you must be logged in!
  Posted by Duncan Brinsmead  on  22 Jul, 2008  at  06:20 PM

The restLengthScale is currently not a mappable or per vertex attribute( on either the nCloth or nConstraint ), thus this editor would not work with it. Hopefully at some point we will make it a mappable attribute, as I have often wanted control over that. It might be especially nice if one could control it separately in U,V for the nCloth.

  Posted by Brocknoviatch  on  21 Jul, 2008  at  11:15 PM

Could you do this for rest length scale on a dynamic constraint?

 
Page 1 of 1 pages