Auto rotation for carTyre, Wheel in maya

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

Advertisements

Saving skinWeights for massive from maya (scMassiveSkin.mel)

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

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

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

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

Arjuna – The warrior prince

I worked for movie named Arjuna while in UTV. I worked on lead character Arjuna ,fish rig and many other BG characters. Our director Arnab Chaudhuri and animation director Pawan , they really pushed our team to limits. even with small team they did great work. As usual for rigging artist deformations were pain in ass specially those shoulder areas..

Well best of luck to arjuna team !

Stretching IK chains, with auto stretch and..

Howdy friends its long since i last posted, well lot of things happening i finished cgWorkshop by todd widdup,
it was very good experience, also i am now at new studio Pixion.Its very dynamic and young studio.

Maybe all these things kept me bounded. Now back to subject i Wanted to share my technique for stretching limbs in character.I remember when i started rigging it used to be hot topic. In my setup i tried to keep things as simple as possible. Setup has few advantages like apart from auto stretch one can use individual stretch say at elbow and wrist and this work smoothly with auto stretch ie. when limbs are stretched auto stretch won’t happen till the limbs are straight.Please check video file below for demo of stretchy system.

Stretch happens when chain length increase from its maximum length ie. when IK chain is straight. So stretch factor is calculated by dividing present length with default length (joint1 + joint2).

I am also attaching a sample maya scene file please check for yourself.
stretchyLeg.ma