scSaveWeights for export/importing skinCluster weights in Maya

Posted in maya, MEL, Rigging, Uncategorized with tags , , , , , , on January 23, 2012 by underearth

I have written an useful Maya python API plugin which exports out weights from polygon mesh or vertices to text file(optionally binary),Which can be used later.
This process is mostly useful when User wish to change position of joints in a rig with skinCluster , or just want to update rig file with latest weights from other file.
I have in past used Michael comets famous Mel script cometSaveWeights, which works great but is very slow when importing weights on dense mesh.

It was my first attempt at writing something in Maya API. Attached in plugin which I have tested on Maya 2008 to 2011. Right now its command line but UI is coming soon.

Mel Command to export weights
scSaveWeights -roundOff 5 -action “export” -file “d:/weights.txt”;

Mel Command to import weights
scSaveWeights -action “import” -file “d:/weights.txt;

Download
scSaveWeights.py

Go to windows>Settings/prefrence > plug-in manager and browse to the scSaveWeights.py
I would suggest to open the py file in IDE and read through comments in the beginning of  script.

ICE cream sandwich

Posted in myOwn, Uncategorized with tags , , , on January 23, 2012 by underearth

I have a confession to make. I am slowly becoming ROM junkie. I got my first android device about three year back(HTC hero) After it got old and was crying out loud for retirement, I got myself nexus 4g. Its cdma device and has its pains involved to make it work in India.

But anyways today I have installed  AOSP ICS ROM on it with custom kernel(Glados). Making battery life in this baby almost 50 percent more.
If you are with same specs. I highly recommends you to visit XDA developers and get the ICS rom for your nexus S.
So bye bye gingerbread and Hello ice cream sandwich.
XDA aosp

“Toonpur ka superhero” My first theatrical credit

Posted in myOwn, Rigging with tags , , on March 7, 2011 by underearth

I’m already late, for posting this, but let’s be late then never, I worked on “toonpur” for quite brief time when I was at pixion studio mumbai.
My work includes, mostly fixing out current rigs, rigging some new characters, and providing solution to animator on scene basis.
This movie has lots of squash stretch involved per character basis, which was quite a challenge.
Indian animation is still in its early stages, in terms of production and finances too. Film did fairly well in Indian cinemas, which are widely dominated by bollywood masala flicks.

Nonetheless it gave me my first theatrical credit, I’m thankful to Mr. Ajay Pratap Singh, who is CG head of pixion,
for heading the team to efficiently and timely delivery of product.

cometSaveWeights.mel for maya2011

Posted in maya, MEL, Rigging on October 3, 2010 by underearth

Well nothing to say much, if you’re into maya rigging you can’t possibly haven’t came across cometTools. I’m a big fan of Michael comet and his tools specially PSD and his mel script.I noticed cometSaveWeights.mel is not working exactly as it has to be on maya 2011, as Autodesk have done some changes to mel commands, I have attached edited version of script which works very well on 2011.

check for yourself Download here

Edit: Enable normalize weights before you save weights in maya 2011,
“;” was missing in some line, that is fixed now.

PyMEL 1.0 and maya 2011

Posted in maya, Rigging on October 3, 2010 by underearth

I been away from my blog for few months, well I been working on few things most of them not rigging related. I have learned hard way how to keep check on your fitness, but came out in good shape. Studio job does takes toll on your health nd sitting on chair for long hours is defiantly a big No No. I set a target and achieved it. in a nutshell i’m in better shape now . So Autodesk few month back released maya 2011 with pyMel 1.0. I didn’t remember last time when i was excited for maya release but this time autodesk have nailed it specially in rigging and animation (here for full details). Yesterday Autodesk has released SP1 for maya 2011 after 3 hotfix release, which is standalone installer (no need for any previous autodesk maya 2011 installation) Go check out whats new here in maya 2011 SP1 and download link here for maya 2011

Auto rotation for carTyre, Wheel in maya

Posted in maya, MEL, Rigging with tags , , , , , , on September 5, 2009 by underearth

I recently worked on creating solution for wheel auto rotations inside maya. Well I searched a lot for finding adequate solution but some lacks a thing or two.
most commonly used solution are rotating the wheel based on translation X & Z with circumference of wheel , which is working fine but gives error when controller
is rotated in reverse direction( 180° or more). Another solution I found is to use Infinite animCurve and attach it with multiplier and manually animating it!

A guy named darvy has created a set of vehicle rigging scripts I found above method nicely implemented in there.

I find one tricky way to calculate auto rotations without worrying about rotations and direction where our rig is going. In brief I wrote expression which finds direction magnitude
where our wheel is going (forward or back). Also expression calculate the distance covered by wheel between last frame and current and calculate distance using circumference (2 π r)


Code:

float $radius =1;
int $dirVec;
// get Joint translation value for calculating direction vector.
float $pastValX = `getAttr -time (frame -1) basePos_jnt.tx`;

float $pastValZ = `getAttr -time (frame -1) basePos_jnt.tz`;

// Now compare the difference of tip joint with base joint and basejoint’s previous frame

float $currPosX = tipPos_jnt.translateX – basePos_jnt.translateX;
float $currPosZ = tipPos_jnt.translateZ – basePos_jnt.translateZ;

// with past

float $pastPosX = tipPos_jnt.translateX – $pastValX;
float $pastPosZ = tipPos_jnt.translateZ – $pastValZ;

// now calculate the magnitude

float $currMag = `mag << $currPosX,0,$currPosZ>>`;
float $pastMag = `mag << $pastPosX,0,$pastPosZ>>`;

if ($pastMag >= $currMag) $dirVec = 1;

else $dirVec = -1;

// get controls translation value for actual calculations.

float $pastCtrValX = `getAttr -time (frame -1) placement_ctr.tx`;
float $pastCtrValZ = `getAttr -time (frame -1) placement_ctr.tz`;

float $currDistX = placement_ctr.translateX – $pastCtrValX;

float $currDistZ = placement_ctr.translateZ – $pastCtrValZ;

float $distance = ($currDistX*$currDistX) + ($currDistZ*$currDistZ);

$distance = sqrt($distance);

// finding distance by dividing into circumfrence

float $rotation = $distance /(2* 3.1428*$radius) *-360 * $dirVec;
$rotation += tyreRot.rotateX;

tyreRot.rotateX = $rotation %360;

sample sceneFile

Saving skinWeights for massive from maya (scMassiveSkin.mel)

Posted in maya, MEL, Rigging with tags , , , , on September 5, 2009 by underearth

Some time ago I wrote a MEL script for saving out skinWeights for massive from maya skinCluster. Script writes out weight is massive’s native format (.w file extension).
Massive is crowd simulation software and is used for giving artificial intelligence to crowds and make them believable. Its common practice to skin character inside maya and take out skeleton ,mesh (as obj) inside massive for doing crowd sim. But we have to either skin it again inside massive which is defiantly not very intuitive or import weights from maya. So this script makes this task easier by writing out weights in separate file from maya itself.

scMassiveSkin.mel

Discovering PyMEL

Posted in maya, MEL with tags , , on September 5, 2009 by underearth

Yes, i was the one who used to love mel like anything. I think i still do for its simplicity inside maya,
but it was time to move on..

I haven’t looked much around in other 3d packages but everyone was saying python is way foward.
I used python inside maya and find it pretty boring cluttered repetitive compared to MEL
(apart from standard python librarypython inside maya has nothing to offer).

And then about year pass by i was member of Google group PYTHON_INSIDE_MAYA they were developing PyMEL
guy named Chad Dombrova actually cook this whole new concept of pythonic way to look inside maya.

I gave PyMEL shot about a month back i installed release 0.9.1 and i was completely hooked. Before i go further i must say
I think PyMel is way forward to do scripting and programming inside maya (the python way). I also think there are some tiny miny glitches
here and there inside PyMEL which may prevent you from migrating, but with so many talented people collaborating i don’t think there would be
much problem once the final build is released.

Maya commands the PyMEL way:

mel code :

getAttr “pPlane1.translateX”

PyMEL:

>>> plane = polyPlane(n=’myPlane’)
>>> plane.translateX.get()

0.0

>>> plane.translateX.set(10.0)

Basically what PyMEL does is it attaches attributes directly to object (PyNode) and then we can play with those attributes and properties (Methods)
It is whole OOPS based system with classes and all those modern language terminologies put into practice. With objects inheriting properties from
parent classes like “joint” inheriting from “transform” and all

Mahayoddha Rama Trailer

Posted in maya, myOwn, Rigging with tags , , , , on May 19, 2009 by underearth

Hey friends as i posted earlier i been working on movie “Mahayoddha Rama” at pixion. Now as trailer is out i would love to share it with you guys.
I worked as character rigger in movie along with some very talented guys. Hope you like it. I would like to share i worked on almost all birds character in this movie and i was daily joke with collegues asking me if birds are flying.. well i some how did it.. and end result was good..

Dual quaternion

Posted in maya, Rigging with tags , , on May 15, 2009 by underearth

Recently i found a new method that has been discovered by guy named Ladislav Kavan
basically it reduces artifacts of linear blend skinning( maya smooth skinning), which happens when bones rotates a lot.. specially during twisting, otherwise knows as candyWrap effect he describe it as linear combination of dual quaternions.

another guy named Guido de Haan has implemented it inside maya as plugin. check his page to download it. well i am playing with it right now.. hope to put some results over here.

Another interesting link i found which shows dual quaternion implementation inside softimage as ICE network.( i personally find it quite cool). check out there demo.
softimge implementation

and here is Blender’s implementation blender is fastly catching up with other 3d packages.
here is there cool little demo
blender dual quaternion

Follow

Get every new post delivered to your Inbox.