Monday 24 March 2014

soup - bounding object, geo volume

SOUP (Peter Shipkov) - how to use an object to select points/faces/edges by volume

- get selection object, make scatter points within (remember to connect world matrix to in matrix)
-setup group/bounding object as usual
-set bounding object to "geometry"
- use a points to mesh node on scatter, connect that into bounding object as mesh

ta da!

Tuesday 18 March 2014

Transfer UVs after rigging


Transferring UVs AFTER rigging....

This is a tough one, but here's the HACK. Lets say you've rigged up your amazing character and realize OH, I have to make a bunch of UV changes. You copy out your character's head, UV it up nicely, bring it back in and use the "transfer attributes" from your copied head to the rigged one.
No deal. It's because your transfer attributes input comes after rigging and all UV inputs have to come before rigging. Same as in Ncloth.
I don't understand why Autodesk doesn't put in a "before deformers" option or something similar to how you can insert blendshapes at certain parts of a deformer chain.
ANYWAY
Every object has a "shape orig" node which represents what an object was before it was deformed. We can apply a UV transfer to this no problem which will also transfer up the stack to your rigged object.
I access it like this

1. Select your rigged object, in the hypergraph hit options/display/ hidden nodes & shape nodes
2. You'll see a hidden node which is your Orig node, or what your object was before rigging.
3. In the orig node's attribute editor under object display, uncheck 'intermediate object'
4. Your Orig node is now accessible.
5. Apply your UV transfer attributes to it - then delete it's history.

There you go - you've applied your transfer to your object via it's history object. Maya sees it that you performed this operation before rigging. Now why Autodesk hasn't made a tool for this....who knows.


Straight up stolen from http://animbiz.blogspot.co.uk/2010/02/transferring-uvs-after-rigging.html
script by Zeth Willie!

//zbw_cleanTransferUV
//by Zeth Willie
//install in scripts folder and run "zbw_cleanTransferUV"
//select object w/ uv's then object to be transferred to then run
//zeth@catbuks.com


global proc zbw_cleanTransferUV()
{
string $sel[] = `ls -l -sl`;
int $sizeSel = size($sel);
if ($sizeSel != 2){
 error "hey. 2 objects. Select source then target";
 }
string $source = $sel[0];
string $target = $sel[1];
print ($source+"\n");
print ($target + "\n");

//try to do it by just reading SECOND shape node (first is shape, then ORIG, then other shape)
string $targetShapes[] = `listRelatives -f -s $target`;
string $targetOrig = $targetShapes[1];

//dummy check that this is orig object (is it intermediate? does it contain "orig"?)
if ((`getAttr ($targetOrig+".intermediateObject")`) && (endsWith ($targetOrig, "Orig"))){
 //turn off intermediate object setting on orig
 setAttr ($targetOrig + ".intermediateObject") 0;
 //transfer uv's to "orig" shape of target
 select -r $source;
 select -add $targetOrig;
 transferAttributes -pos 0 -nml 0 -uvs 2 -col 2 -spa 4 -suv "map1" -tuv "map1" -sm 3 -fuv 0 -clb 1;
 select -cl;
 //delete history on target orig then turn back on intermediate object attr
 delete -ch $targetOrig;
 setAttr ($targetOrig + ".intermediateObject") 1;
 }
else  {
 error "couldn't find the orig shape of the target object. make sure it's a bound/deformed thing";
 }
}

zbw_cleanTransferUV;