Friday, September 02, 2011

Swapping out rotation orders under an animation

Not an everyday thing to use, but useful when something like this crops up. . . 
Rotation orders are always kind of important, but on certain animations it can be pretty necessary to manage them correctly (I'll try to do a separate post on rotation orders in general later).
I was just on a commercial recently where I was tasked with animating a couple of leaves fluttering into position. Somehow I got something sideways in one of the leaves and already had a fairly decent animation base down before I realized it. One leaf was correctly oriented in the rig to point in X and the other got perpendicular in Z. I built the entire rig for both as though they were pointing in X with the default rotate order (XYZ) and thus had two slightly different behaviors. I couldn't get a clean rotation down the axis of the leaf that was oriented in Z because the rotation order was incorrect (should have been ZYX, if I remember correctly). The general rule of thumb is that you usually want any channel that you'd like clean to be FIRST in the rotate order (though technically, that means it rotates last). Anyways, that's a fairly easy fix in the rig, just had to go back to my working version and change the rotate orders of the control structure elements, publish it back to the master version and done.
BUT, since I'd already animated a bunch of stuff, swapping the rotation orders under the published version of the rig would mess all the rotations up. Didn't want to have to match each keyframe by eye, but there seemed to be no numerical way to match stuff up. I was banging my head against the wall when I asked Brad Friedman, who's a really smart pipeline TD at Method and he told me unequivocally, "nope. Can't be done mathematically".  My next thought was to try to go to a key, orient constrain the object, delete the constraint, key it and repeat. The evil trick, though, is that this isn't even doable by hand (except to go through and key by eye), because even if you were to try and constrain then delete the constraint, then key the value, it would blow away any keys you previously had. So you can do that once, but not multiple times over the length of the animation. Ugh.

So I came up with a quick little script (with a python assist from Brendon, who's another smart pipeline TD there).
Basically the idea is this, you have a scene with your incorrect rotate orders already animated. Import your new rig with the correct rotation orders. Select the animated original, then the new rig, then run the script. It will find any keyframes for rotation and translation. For each keyframe, it will point and orient constrain the new rig to the old rig and store the translate and rotate values of the NEW rig (which are the numbers, at least rotation, that aren't derivable from the orig data) and then, once it's stored them all, go back and key those stored values at the correct frame for your new object. Finally, it will run an Euler filter on the lot of the new curves (I noticed some rotations can get a bit weird without it).
Not perfect but serviceable and fast. Which is good cuz it was my mess up in building the rig that started the whole problem!

So here's the script:
zbw_swapRotateOrder.py.zip (rt-click,save as)

To use this, drop it in your version/scripts folder (or wherever else you stash your python scripts) and then in Maya, select the original object, then the new rotation order rig and type:
import zbw_swapRotateOrder
zbw_swapRotateOrder.swapOrder()

Once you've imported the script, you just need the second line to run the function thereafter, I believe. (I can write the python scripts fairly simply, but using them in Maya still seems like a pain to me)

Thursday, August 11, 2011

Follow up some Linear Workflow stuff for Maya 2011 +

Been meaning to do this for a while, but never got around to it . . . And I got scooped a little bit! Derek Flood did a couple of short videos about this and lit a fire. Thanks Derek!
Anyways a quick overview (as quick as I can do it, everyone else seems to have a better grasp of the brevity thing than I do) of how linear stuff embedded in Maya 2011/2 relates to what you may have been doing before . . . not expansive, just pointing a few things out.
*EDIT* Derek was kind enough to point out some of the specific bugs/weirdnesses he's found in the comments. Check it out if you're interested!

Maya/Mental Ray: Linear Workflow in Maya 2011 from zeth willie on Vimeo.


HERE'S (rt click, save as) the updated zbw_gamma script that works by shader selection and sticks gammas into the color channels. You can also adjust any/all gamma nodes in the scene or delete them globally.

Wednesday, August 10, 2011

Creating a reflection "sheen" pass for your scene

Every semester I end up explaining this in a really rushed and half-hearted way to a bunch of poor students who are in my animation class. Rather than do that again, I finally wised-up and made a video about it. . .
Somehow my videos seem to get longer and longer, so I split this up after the fact and made two videos (it's like my inner self is telling me to do less videos and more text-y type tutorials).
The first video is the basic stuff for setting up a render pass that will give a nice shiny reflection pass for your scene (stuff like a cell phone or tv in a commercial) and the second chunk of it gives a few ways to customize this concept and make it a more reusable using things like RGB passes for various different reflections, etc.
This is something that is really useful to know how to do in production, especially for stuff like commercials, so hopefully I haven't made it tooooo loooong and boring . . .

Maya/Mental Ray: Rendering a reflection "sheen" pass - part 1 from zeth willie on Vimeo.


Maya/Mental Ray: Rendering a reflection "sheen" pass - part 2 from zeth willie on Vimeo.



BTW, HERE'S the script that I use at the end for pulling stuff out to a render layer with custom color overrides . . . (rt click, save as)

Tuesday, August 09, 2011

A little script for those big scenes . . .

A little script from a job with a HUGE environment (basically a city made to scale in cm units. Good grief). Just to help get things moving more quickly I threw this together. The cameras layouts were set up and we had to throw the characters into the scene, but when we referenced them, they came in at the origin which might be 10's of thousands of units away from the camera position.
So to ballpark things I made this script. . . Really simple actually, select your camera, enter a distance and hit "create Locator" which will create a locator at the specified distance in front of the camera. (Or you could make your own, though that kind of defeats the purpose) You can then move the locator around if you're not happy with the distance or undo and try again with a new distance.
 Then go the outliner and select the locator you want, then the group or object you want to place at the locator and hit snap. The script will just snap the position of the object to the locator in front of the camera. . .
Not a big deal, just something to ease the pain of trying to pull things around a scene that's way too big for it own good :)
HERE is the script if you want to have a go.  (rt click and save as)

Creating an auto-swimming fish rig using expressions

I while back I posted a video about using joint chains in rigs and one of the things I demoed was a fish rig I had created for Method Studios. I got a bunch of questions about how I set that up, so here are a couple of videos about using expressions to control the auto-swim part of that rig (which IMO is the tricky part).
If you're an expert at expressions and such, probably nothing new here but if you're not this might be a good example of using expressions in rigs (for things other than auto-stretch, which seems to be the most common thing) . . .

Maya/Rigging: Creating an auto-swim fish rig using expressions, Part 1 from zeth willie on Vimeo.


Maya/Rigging: Creating an auto-swim fish rig using expressions, Part 2 from zeth willie on Vimeo.

Monday, August 08, 2011

Follow up on corrective shapes for Maya 2011 . . .

Sorry for the lack of posts, been pretty busy (which one can never complain about these days, though I try). Seems like this will be the M.O. generally speaking. . . Nothing for a while, then a flurry of stuff.
Well, get ready to be flurried on, cause I've got a bunch of stuff to throw up here in the next few days while I have moment :) Let's start with some follow up material:

Did a post on pose space deformation, or corrective shapes, a little while ago. Here's an update of some scripts, etc that may work for you (mileage may vary) in later versions (post 2010). I haven't had much time to play with these unfortunately, but if I come up with anything else, I'll let you know . . .

extract deltas from brave rabbit playground
This works nicely . . . but be careful about the scaling and transforms of your orig mesh. Seems like the script is having trouble recognizing at least any scale values in the bound mesh (so you'll get a tiny or big blendShape mesh as your result if there are scale values other than 1 in the orig mesh. Which there shouldn't be, but still . . .)

http://www.chadvernon.com/blog/resources/cvshapeinverter/ - cvshape inverter from Chad Vernon
Watch some of this guys videos. Seriously off the hook skills. This plug in is giving me some trouble though. Seems from the comments like some people have gotten this working. Not me. Might be my stupidity re: how python stuff works, might be something to do trying it on my Mac, but while I'm seeing the plug-in, I'm not getting the script version to work, failing on "import" (tried this on a PC at my last gig but didn't have access to the plug-ins folder to install everything. But it seemed like it was trying to work than on my Mac. Hmmm).

http://www.djx.com.au/blog/downloads/ - look for "poseDeformer" towards the bottom
This seems pretty interesting and certainly has lots of options . . . check out a walkthrough of features here. Seems like it was written a while back and is just being updated for newer versions of Maya. But also seems like overkill in most instances (at least for me) and because of all the bells and whistles, seems like it may require ALL the artists on the team to have it installed (at least those that need to see the deformation at the rig level). Can't even be fussed to install this :p