nCloth Zipper
Here is a tutorial to add a little zip-a-dee-doo-dah into your animations.
Constraining cloth with a zipper can be more of a challenge than with buttons because the zipper connection is continuous across a boundary. Simply breaking constraint connections between vertices will cause a popping animation unless the meshes are very detailed. The zipper animation in this tutorial relies the uv parameterization of the surface to define the position. We use a ramp texture applied to the constraint strength in such a way that the constraint is gradually released as the zipper position is moved resulting in a smooth animation. A follicle node (from Maya Hair) positions the zipper object at the correct position along the dynamic cloth boundary. Follicle nodes are useful for deriving a transform from a uv position on a mesh.
To see how it works load the file: zipper.ma (you can find this at the bottom)
then select the red zipper object. A slider should appear in the viewport when you select the zipper. Now if you playback you can edit the zipper position while playing back using the viewport slider. To keyframe the zipper position you can key the "Parameter V" value on the node "zipper_follicleShape". In this example the viewport slider is just for demo purposes. The file has a scriptJob, created on file open, that builds the screen slider on the zipper selection event. However this demo will not go into how to setup such a slider.
then select the red zipper object. A slider should appear in the viewport when you select the zipper. Now if you playback you can edit the zipper position while playing back using the viewport slider. To keyframe the zipper position you can key the "Parameter V" value on the node "zipper_follicleShape". In this example the viewport slider is just for demo purposes. The file has a scriptJob, created on file open, that builds the screen slider on the zipper selection event. However this demo will not go into how to setup such a slider.
First lets setup two cloth planes and connect them together.
1. Create two poly planes and move the second plane one unit to the right (translateX =1) so they just touch.
2. Select both planes and do MENU "nCloth: Create nCloth"
3. Select two cvs on the far corners of each plane. (4 cvs altogether) then do MENU "nConstraint: Transform".
2. Select both planes and do MENU "nCloth: Create nCloth"
3. Select two cvs on the far corners of each plane. (4 cvs altogether) then do MENU "nConstraint: Transform".

The planes should now fall and hang from the constrained cvs when you playback.

Now lets join the two planes together in the middle with a constraint.
4 Select the cvs along the touching edge and do MENU "nConstraint: Component to Component"
The planes should now stick together as they fall. To avoid any gap at all between the planes as they fall you can edit the dynamicConstraint node and change the constraint method to "Weld", instead of "Spring".
4 Select the cvs along the touching edge and do MENU "nConstraint: Component to Component"
The planes should now stick together as they fall. To avoid any gap at all between the planes as they fall you can edit the dynamicConstraint node and change the constraint method to "Weld", instead of "Spring".

5. Map a ramp texture to the strength map attribute of the node "nComponent3". (Click on the checker button next to this attribute in the attribute editor then select the ramp texture) Note that there should be 4 component nodes so far, two for the first constraint created and two for the second. When you create a constraint each mesh participating in the constraint gets an nComponent node. The nComponent node defines for a mesh which elements to use and how they participate in the constraint.
6. Edit the ramp texture. Make it a simple greyscale ramp going from black to white at the top then try moving the black indice up and down during playback. The two planes should partially "unzip" as you do this. We will not animate the ramp indices in this manner, however, as it is easier to use the texture placement. So set up the ramp such that it is has a fast transition from white to black in the middle: position the white indice at 0.5 and the black at 0.45.

7. Edit the ramp texture placement ("place2dTexture1").
Repeat UV = 1.0, 0.25
This stretches the ramp so we can animate the offsetV value to fully open and close the zipper with the ramped transition from white to black. An offset of .55 is fully zipped and 0.175 is fully open.
At this point you can simply keyframe the texture placement offsetV from .55 to 0.175 to open the zipper.
The rest of the tutorial describes how to automatically position a zipper object. We will use a hair follicle node for the point on mesh capability.
Repeat UV = 1.0, 0.25
This stretches the ramp so we can animate the offsetV value to fully open and close the zipper with the ramped transition from white to black. An offset of .55 is fully zipped and 0.175 is fully open.
At this point you can simply keyframe the texture placement offsetV from .55 to 0.175 to open the zipper.
The rest of the tutorial describes how to automatically position a zipper object. We will use a hair follicle node for the point on mesh capability.
8. Select pPlane1 and do MENU "Dynamics: Hair: Create Hair"
In the "Create Hair" option box set the U and V counts to 1.
In the "Create Hair" option box set the U and V counts to 1.

9. Delete everything created in the last step EXCEPT for the follicle node. One can select "hairSystem1" and "pfxHair" in the outliner then delete with the delete key. There is also a curve ("curve1") under the follicle that can be deleted if desired.
10. Create any zipper shaped object. A simple zipper is a poly cube scaled down. One can select the cvs on the leading edge and scale down in x to give it a wedge shape.

11. Parent the zipper object ("pCube1") to the follicle ("pPlane1Follicle5050") A simple way is to middle mouse drag the zipper onto the follicle in the outliner. The zipper should now stick to the cloth during playback.

12. Set the follicle parameter U to 1.0 so that the zipper is positioned along the boundary. (edit "pPlane1FollicleShape5050" in attribute editor) Editing the Parameter U from 0 to 1 should now move the zipper up and down the length of the edge.
13. Create an expression to set the ramp texture "Offset V" based on the the follicle "Parameter U" value. MENU "Window: Animation Editors: Expression Editor" In the large expression field type:
place2dTexture1.offsetV = (1-pPlane1FollicleShape5050.parameterV) * 0.25 + 0.25
then hit "Create".
The tutorial is now complete. You should be able to keyframe the follicle parameter V in order to position the zipper. For fun in the attribute editor CNTRL drag the mouse in the edit cell during playback to open and close the zipper.
place2dTexture1.offsetV = (1-pPlane1FollicleShape5050.parameterV) * 0.25 + 0.25
then hit "Create".
The tutorial is now complete. You should be able to keyframe the follicle parameter V in order to position the zipper. For fun in the attribute editor CNTRL drag the mouse in the edit cell during playback to open and close the zipper.

editPfxOnPolyPath.mel
parentToSurface.mel
nClothBook.ma
dynamicFollow.mel
cameraFollow.mel
cameraFollowScene.ma
lightOcclusion.ma
fireball.ma
itsSlinky.ma
TunShu_BindClothSkin.zip
confettiFall.mb
simpleConfetti.ma
roundConfetti.ma
partyStreamers.ma
waterTank.ma
nClothWater2.ma
nClothWater.ma
waterPlayground.ma
sunsetLeaf.zip
oakBigLeaf.mel + oakBigLeaf.mel.icon
ribbonTwist.ma
bagOfMarbles.ma
toonOcean.ma
buckySphere.ma
thickSlab.ma
phoneChord.ma
forestRoad.ma
bark.iff
basicLeafHC.jpg
birchBark.gif
grassRoad.jpg
leafSerrate.tif
WhiteBark.tif
sideleaf.rgb
atmosphere.ma
writeHello.ma
zipper.ma
parentToSurface.mel
nClothBook.ma
dynamicFollow.mel
cameraFollow.mel
cameraFollowScene.ma
lightOcclusion.ma
fireball.ma
itsSlinky.ma
TunShu_BindClothSkin.zip
confettiFall.mb
simpleConfetti.ma
roundConfetti.ma
partyStreamers.ma
waterTank.ma
nClothWater2.ma
nClothWater.ma
waterPlayground.ma
sunsetLeaf.zip
oakBigLeaf.mel + oakBigLeaf.mel.icon
ribbonTwist.ma
bagOfMarbles.ma
toonOcean.ma
buckySphere.ma
thickSlab.ma
phoneChord.ma
forestRoad.ma
bark.iff
basicLeafHC.jpg
birchBark.gif
grassRoad.jpg
leafSerrate.tif
WhiteBark.tif
sideleaf.rgb
atmosphere.ma
writeHello.ma
zipper.ma
In order to post any comments, you must be logged in!



