5 comments on “Fun with animatable weights

  1. Hey Cedric, good to see you working on this. In my opinion a lot of developers try to make all sorts deformers to get various effects but I think methods for controlling their weight maps has been sorely overlooked.

    I’ve made a small suite of nodes that are used to create and manipulate doubleArray attributes and an arrayToMulti conversion node (which SOuP also has) for plugging the end result into a standard deformer. These nodes I’ve found have expanded the functionality of deformers by a massive amount. I look forward to reading about what you discover on your way.

    One thing I’d like to ask is how have you connected your nodes to the blendShape weights? BlendShape nodes are annoyingly different to other deformers in that their weight attribute structure is different. From what I’ve read, Peter Shipkov had to hack some things into his weights node to get it to plug into the blendShape node but even still it doesn’t work 100% of the time and the updating isn’t always instantaneous. This is no fault of Peter’s, Autodesk is the one who should update the blendShape node to fall into line with the other deformers.

    Good luck!
    :¬)

    • Hello Brad, you are with other people like charles Looker, Paule neale, borislav petrov and chris landreth my “rigging heros”( non-exhaustive list don’t bash me… ), most of my education in this field was stolen from your contribution. Peter is a genius himself, it’s funny to see his hack that involves executing a getAttr mel command inside a node to force maya to refresh the weight multi array.

      @blendShape weights : simple answer in my node the array compound attribute weightList also have a children weights array attribute of type double much like any deformer : we can plug the parent array into the deformer weightList attribute.
      To fill this attribute I just use 2 arrayDatabuilder

      void vertexWeights::write_weight_datas( MArrayDataHandle & weightsHandle , MDoubleArray & vertexWeigths, MObject & thisNode)
      {
      MArrayDataBuilder cBuilder = weightsHandle.builder();
      unsigned int bldSize = vertexWeigths.length();

      cBuilder.growArray ( bldSize );
      int elemIndex = 0;
      MDataHandle currentDH ;
      MDataHandle outDH ;
      for ( unsigned int n=0; n< bldSize ;++n)
      {
      currentDH = cBuilder.addElement(n);

      MDataHandle wtChild = currentDH.child( weights) ;
      MArrayDataHandle hArrWts ( wtChild ) ;
      MArrayDataBuilder cBuilderB = hArrWts.builder();

      outDH = cBuilderB.addElement(0); // bldSize) // <-- if the point count change we can destroy unused ID
      {
      for ( unsigned int n=bldChck-1; n<bldSize-1;--n)
      {
      cBuilder.removeElement(n);
      }
      }
      weightsHandle.set(cBuilder);
      weightsHandle.setAllClean();
      }


      I doesn’t trigger a new evaluation of the blendShape properly . So in the end instead of updating weights and connecting it to other deformer I insert before or after the deformer my node to compute a weighted vector offset then output a mesh data. It seems less glamorous but its fast and enable us to reach our goal.

      • I am humbled to be on your list. Thanks.

        Unfortunately I can’t quite get my head around your last paragraph explaining your trick to get around the blendShape node’s inability to receive a dirty flag. Are you saying your have a custom deformer after the blendShape that you put your dynamic weights into as well as the blendShape? Do you put the outputGeometry of the blendShape into another mesh and put a custom deformer on that? I don’t really understand what you’re doing at the end there. Sorry.

        :¬)

  2. Oh wait, are you saying you made your own deformer that you use as a replacement for the blendShape node?

  3. Exactly , I was lazy this week as i was writing and maintaining 3 nodes a the same time + UI and script to setup and connect the require element: this is just a dumb node that output a mesh and internally act as a blendshape node with only one target. Doing a deformer with the same behavior is trivial and can be done without much effort. To influence a blendshape node I have done a quick test and I simply plug 4 dumb node into their target inMesh attribute and leave their global weight in full effect.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s