Tuesday, September 9, 2014

Blendshape driver using linstep in Maya


Today i was working on a muscle rigging project and when it was time to get a muscle moving with a joint i wanted a quick way to trigger the squash and stretch blendshape. So basically i used an expression with Maya's linstep function.
Basically linstep(0,4,4) should give a 1, linstep(0,4,2) should give a 0.5 and linstep (0,4,0) should give a 0. Using this i can get 0-1 numbers to drive a blendshape.

I ended up using linstep( 0, max low leg rotation, low leg rotation value ) to drive a blendshape.

here's an example:
 and mel expression code:

//temporary code to turn on muscles
blendShape2.mm_squash = 2*linstep(0,110, max(l_leg_3_skin.rotateY,0) );  //110 is max rotation lower leg, max so squash turned on only when positive leg bend
//the constant in front is between 0-10 helps make shape effect happen sooner

hope you find this helpful.


Inspired by
Matt Derksen's online tutorials on muscle rigging (accad dot osu dot edu/~mderksen/tutorials/)