Thursday, November 6, 2008

Animating on 2's

Animate with in Maya on twos (every frame holds for 2 frames) then render out properly at 24 FPS without having to key every pose twice. I suppose one could animate at 24 fps and key every second frame twice.

I decided to animate in Maya at 12 fps and set the render settings to render out twice as many frames, each keyframe duplicated. All done at render time. And here's how to do it.

1. In your preferences set the maya scene to 12 FPS.

2. In your globals set the 'by frame' to 0.5 - this will render sub frames inbetween (twice as many) i.e. frame 1, 1.5, 2, 2.5 .Maya will name the sequence properly.

3. For the subframes to be duplicates of the keys, they need to be the same values as the keys before them. Every frame needs a keyframe and every curve has to be stepped. This means we have to bake the animation curves and set them all to stepped before rendering.

4. Handy little MEL script to do that?....yes (the first part selects all objects that are animated)
Put this script in your scripts directory.

global proc bake() {
select -cl;
$sel = `ls`;
for( $s in $sel ) {
float $info[] = `keyframe -time ":" -query -timeChange $s`;
$si = size($info);
if ($si>0) {
$nt= `nodeType $s`;
if ($nt!="objectSet" && $nt!="animCurveTU" && $nt!="animCurveTA" && $nt!="animCurveTL")
select -tgl $s;
}{bakeResults -sampleBy 1 -preserveOutsideKeys 0 -sparseAnimCurveBake 0; keyTangent -e -ott step;}


global proc bakeselected(){
bakeResults -sampleBy 1 -preserveOutsideKeys 0 -sparseAnimCurveBake 0;
keyTangent -e -ott step;}

5. Additional advanced wouldn't want to bake all the channels, render, then find mistakes on your saved file - all of your curves will be littered with keyframes which would be hell to fix. You could save out baked files but that's not efficient. There is a way to run this MEL at rendertime only. In render settings under common/render options you will see a Pre render MEL slot.

Slot this little command in there and it will run the bake script at render time ....
*remember to remove it when test rendering in Maya or you will bake while working on the file.

source bake; bake()

Bamm, work within Maya at 12 FPS (twos playback) and render out at 24 FPS with doubled frames.

Need some frames on ones? Well you can hack them out in editing like we did back in the old linetesting days.


set your preferences to 24 FPS (all of your single keys will now take up 2 frames) and put your desired frame on ones. Look fine at 24 FPS? Switch back to 12 FPS and your one will now be on a subframe, thus you'll render key1 and the next subframe will not be a duplicate, it'll be your 'one'. Basically switching to 24 FPS gives you access to control your subframes at 12 FPS.

Toggle 24FPS Mel paste this as a button-->
currentUnit -time film; //24 fps

Toggle 12FPS MEL paste this as a button-->
currentUnit -time film; //12 fps

found this info from Cronin Blog :)


interested to learn more check out Keith Lango Blog

Post 1 & Post 2

No comments: