Labels

Sunday, 15 April 2012

Update for 16 April



So, my control rig was a little broken, and needed to be fixed. Here is the video update showing the rig in progress with the control rig. The script has been modified to look for anything with the prefix "rig" for the control, tokenise it (break it into strings with "_" ), rebuild the joints, and connect any with similar names after the prefix. This means that I can make severe modifications to the rig, but only need to transfer the bones that will be skinned - i.e. the controller bones (FK/IK/auto dynamics and others will not be included).

The issue so far with my setup is that it does not look for any specific hierarchy to copy to, unlike my previous script - causing issues if there is more than one similar rig in the scene or another rig with any joints named similarly.

Here is the working script:
 <code>

///////////////////////////////////////////////////////////////////////////////////////////////
//    Sophie Brennan - Control Rig Setup
//
//  How to use this script:

//   1. Make sure your group node containing your rig is called "grp_controlRig"
//   2. Make sure each skeleton has the joints named to match with the prefix "rig" and
//    "jnt" for the control and export rig respectively. Also make sure that the joints are
//    in the exact same hierarchy as unwanted translations will occur if the original
//    translations/rotatations are different.
//   3. When running the rig, please specify whether you are breaking or joining
//     connections, i.e. sbControlRig "break"; or sbControlRig "connect";
//
//
/////////////////////////////////////////////////////////////////////////////////////////////////

global proc sbControlRig (string $specifyFunc)
{

 if (($specifyFunc != "break") &amp;&amp; ($specifyFunc != "connect"))
 {
  $doWarning = 1;
  warning "Unknown argument. Please specify either break or connect. ie: sbControlRig break; \n";
 } else
 {
  $doWarning = 0;
  print "Function specified - continuing with script. \n";
 }

 string $rigJoints[] = `listRelatives -c -ad -type "joint" "grp_controlRig"`;
 string $buffer[];
 string $expPrefix = "jnt";
 string $expJnt;
 string $delim = "_";
 int $first;



 if ($specifyFunc == "connect")
 {

     for ($obj in $rigJoints)
{
 // split the joint name in this loop by underscores into $buffer variable
 tokenize $obj "_" $buffer;


 //rebuild the string replacing the prefix

 $first = 1;
 for ($str in $buffer)
 {
  if($first) { $expJnt = $expPrefix; }
  else { $expJnt += ($delim + $str); }
  $first = 0;
 }

 //check the object exists and connection attributes if it does

 if ( objExists($expJnt) )
 {
 connectAttr ($obj+".r") ($expJnt+".r");
 connectAttr ($obj+".t") ($expJnt+".t");
 print ("Rig joint " + $obj + " connected to drive " + $expJnt + "\n");
 }
 else
 {
  print ("Export joint does not exist: '"+$expJnt+"'\n");;
 }
}
    }

 else if ($specifyFunc == "break")
 {

    for ($obj in $rigJoints)
{
 // split the joint name in this loop by underscores into $buffer variable
 tokenize $obj "_" $buffer;


 //rebuild the string replacing the prefix

 $first = 1;
 for ($str in $buffer)
 {
  if($first) { $expJnt = $expPrefix; }
  else { $expJnt += ($delim + $str); }
  $first = 0;
 }

 //check the object exists and connection attributes if it does

 if ( objExists($expJnt) )
 {
 disconnectAttr ($obj+".r") ($expJnt+".r");
 disconnectAttr ($obj+".t") ($expJnt+".t");
 print ("Rig joint " + $obj + " disconnected from " + $expJnt + "\n");
 }
 else
 {
  print ("Export joint does not exist: '"+$expJnt+"'\n");;
 }
}

    }

 else
 {
 //Do nothing
 print "Argument not specified - please specify break or connect. /n";
 }
}</code>

The problem with this system however, might prove making an independent hip controller difficult. SDK on things like the hands have not been done yet (though to save time they will be done via a script I will write - which should be fairly easy to do, as I've been writing scripts to set up IK/FK joints and other tedious tasks) as I finalise and import all the various pieces of the character's mesh.

The main problem with my scripts at the moment is that they are only useful for 1. my use and 2. use with the rig setup shown. While this speeds up my process, it would be almost useless for a studio, which needs adaptable and non-specific scripts for studio-wide use.

For the auto-hood system used, I have driven the hair curve with controllers, where the joints are affected by dynamics. While this produces some really nice secondary motion - collision is a huge issue. I tried to set up rigid bodies for collisions, but because the meshes intersect they are not able to have these dynamics applied. Overall, FK animation may be more efficient but it was a nice experiment and is still available in-case the animator might wish to use it. The method used was observed and de-constructed from Harry Gladwin-Geoghegan's freely available dino rig online, where it was adapted to the needs of my rig.

Things to be done

- fix the hip joint
- find way of attaching the bag
- SDK/various other controllers


Playing with a skin shader and SSS. (subsurface scattering)