Image sequence driven nConstraint weights


So I have a few large pieces of cloth that I need to tear apart using Maya 2013.
I have single meshes that have some nice cuts modeled in and everything sims nicely as a whole piece using Edge weld or Component nConstraints.
I can get it to tear is a random/dynamic way…but the director is wanting more control over which part tears when. I had been successfully using animated ramps on basic square cut tests. But now we have a bunch of lines that would be impossible to use the same ramps on.
So I figured I could just use an image sequence to make some animated weight maps for the constraints. But it doesn’t work!
I was using iff sequences that I created in Maya.
The kicker is that I know I could do this easily with SOUP but it doesn’t work with our 2013 install (our fault, not SOUP’s). I didn’t think it would be a problem, because I thought I could easily use an image sequence. But I can’t get it to work.
Please let me know if this is possible or not.
Thanks so much!


So after a bit of testing I got things working…in a very non-bullet-proof way.
I set up a test scene with the texture I was using to drive the constraint weights assigned to a lambert on the surface so that I could see that the texture was animating correctly. And also follow along to see when things were/n’t working.

Plugging in the image sequence directly into the glue weight map didn’t work. So I plugged the image sequence into a ramp and then plugged that ramp into the glue weight map and that worked like a charm.
(Side note: this “plug into a ramp” trick can do wonders if your shading network isn’t driving dynamic things correctly…not always…but sometimes.)

With everything working in my test scene I went to the actual scene.
I did everything except create the preview lambert and assign it to my surface. And it didn’t work. Turns out the only way I could get it to work was to have the texture displaying and updating in the viewport.
I tried dgdirty -a in a few places…but no success.
Anyway it works.

Any thoughts always welcome.
Hopefully this helps someone out there.
Or at least good for a laugh.
“I post this in multiple forums to gain some visibility…”


One more update here for archival sake.
So I have found what seems to be a more bullet proof way for using image sequences to drive any nCloth attributes. The viewport display method is fine…but only allows one attribute to be driven by one image sequence.
If you use an expression to actually define the image file name per frame (not just the image number part), this forced reload makes it work in the most consistent way I have found.
Here is a little Mel/python expression I was using (python because padding image numbers in mel is crazy complicated):

    string $fileNode="fileIn"; 
   string $imagePrefix="images/animMap";
   string $imageSuffix="tif";
   int $offset=0;
   string $pythonCmd="import maya.cmds as cmds
   python $pythonCmd;


Good info,

About the force update, you could try in the shader, change the hardwareTexture resolution to anyone of them other than “default”, that way will force the viewport update.
Not sure is that is your case, I would interested to know it too.

If using SOuP, do you mean using bouding obj to control the timing?



Yeah, setting the hardware texturing as you mentioned worked, but not when simming on our farm. So it was fine for local sims and all, but I needed a more robust solution. Also, in one case I needed one image sequence to drive the input mesh attract and a different image sequence to drive some dynamic constraint weights. The viewport display only works for one sequence.
A rare case but I had to figure something out.

As for using SOUP, yeah it was essentially using meshes for bounding objects. A whole bunch of nebulous shapes moving over a surface…triggering the cloth. But just rendering out the shapes as a texture has been fine. So all it good.


I’ve gotten some questions on exactly how to use the expression I posted so I thought I would break it down here for sake of documentation.
Just open up the Expression editor: Window > Animation Editors > Expression Editor. Paste the code below in the expression window and hit “Create” If the image path is wrong, you will get a yellow warning. If you get a red error something got broken or you entered the wrong file node.
The lines with the // at the beginning are notes that tell you what to do with lines that follow without the //.
****Check when you paste that there no space added in the first python line. I can’t post the code without a space being added at tAttr(
it should all go together without a space

 // Enter the name of the existing file node you want to drive here. "file1", "weightDrive_file", etc.
       string $fileNode="fileIn";
       // Enter the directory and first part of the image name, before the numbers, here
       // If your image sequence is called "animMap.0001.tif" and its in the images directory of your project
       // then you would leave the $imagePrefix variable as it is.
       string $imagePrefix="images/animMap";
       // This is self explantory with the previous explanation in mind..
       string $imageSuffix="tif";
       // This is for you to offset the sequence if you need to 
       int $offset=0;
       // CHECK FOR ADDED SPACE at se  tAttr and remove space. Couldn't post without space being added
       // Check the image name of the file node to make sure the name string is correct. Adjust previous entries to fix. 
       string $pythonCmd="import maya.cmds as cmds
       python $pythonCmd;
  Hope that helps.


Very interesting trick. Thanks for sharing.


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.