Home Technical Talk

Bake deformer to vertice animation (maya 2009)

I need some help on how to bake a deformer that's affecting geometry to the vertices of that geometry. I want to be able to delete the deformer and keep the animation intact. Specifically my setup is basicly a poly plane that translates through a bend deformer.

I've tried baking it through bake simulation, but the bake seems to ignore the deformer and just bakes the translation.

Help is MUCH appreciated.. I'll even mail you a cookie for your trouble ;)

Replies

  • DerDude
    Options
    Offline / Send Message
    DerDude polycounter lvl 10
    i´m not shure it this suites for your problem, but you can bake an pointcache in maya

    geometry cache>create new cache

    or you can script out an blendshape every frame without the animation and apply it later under your skin cluster. Why is it necessary that you delete the deformer?
  • BuCC
    Options
    Offline / Send Message
    Caching works. Thank you;)

    The thing is that the geometry I'm deforming is about 500-600k polys, so simulating it isn't really an option since the scene becomes unworkable. It also increases my render time alot, so I figure if i can store the deformer data somewhere I'd solve a lot of problems. I just hope my computer can cache it all ^^.
  • DerDude
    Options
    Offline / Send Message
    DerDude polycounter lvl 10
    when maya freeze after you cached the files you can shut down maya, open the scene, delete all deformer and load the cache. (or wait poob. some time, depends on os and machine)
  • claydough
    Options
    Offline / Send Message
    claydough polycounter lvl 10
    If not enuff memory and If deleting all history anyway...
    How about transfering the pnt animation to a duplicate?

    if yes
    save following code as cly_bakeVtxDuplicateTransfer.mel
    select poly object and execute like:

    cly_bakeVtxDuplicateTransfer 1

    substituting 1 for the desired step increment for keys ( integer fer now )

    // code begin ( cuz polycount code tags aren't werking )
    /*
    cly_bakeVtxDuplicateTransfer.mel
    Roger Klado was here
    because no one else will do it fer me
    may16, 2009 ( fer BuCC)
    RogerKlado@gmail.com ( Klado/Claydough/cly_ )
    */

    proc cly_forceVtxPositionTransferKey( string $objectReference, string $objectTarget )
    {
    string $vrtReference[] = `filterExpand -sm 31 -expand 1 ( $objectReference+ ".vtx
    [*]")`;
    string $vrtTarget[] = `filterExpand -sm 31 -expand 1 ( $objectTarget+ ".vtx
    [*]")`;
    int $size = `size( $vrtReference )`;
    for ( $i = 0; $i < $size; $i++ ){
    // re-position and key
    float $refVertPosition[] = `xform -q -ws -t $vrtReference[$i]`;
    xform -ws -t $refVertPosition[0] $refVertPosition[1] $refVertPosition[2] $vrtTarget[$i];
    setKeyframe ( $objectTarget+ ".pnts["+ $i +"]" );
    }
    }
    global proc cly_bakeVtxDuplicateTransfer( int $increment )
    {
    $increment--;
    string $objects[] = `filterExpand -sm 12`; //objects from which to create baked simulation duplicate //to do: make shape
    float $timeMin = `playbackOptions -q -min`;
    float $timeMax = `playbackOptions -q -max`;
    int $totalSteps = ( $timeMax - $timeMin ) + 2;
    for ( $o in $objects ) {
    // duplicate to recieve bake
    string $dup[] = `duplicate $o`; // to do: use -po with shapes
    //makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $dup[0]; // to do: make a preference
    for ( $i = $timeMin; $i < $totalSteps; $i++ ) {
    currentTime $i; // at this time
    cly_forceVtxPositionTransferKey $o $dup[0]; // transfer vrt position
    $i += $increment;
    }
    }
    }
    //end
    // code end ( cuz polycount code tags aren't werking )

    If this is useful to anyone lemme know and i'll add all the stuff that I was to lazy to add.
    ( localized vrt area capture option, transfer back to original option, error checking etc. )

    ps. I wanna mah cookie
  • BuCC
    Options
    Offline / Send Message
    I tried your script in a test scene. Cool stuff :) But it didn't solve my problem as maya kept crashing after thinking 30 min when I applied it to my heavy work scene. I guess dublicating that mass of geometry animated over 1500 frames was more than my poor comp could handle :P
    I can see a lot of use for this script, so I'd say keep developing it. On my wishlist of features would be delete original (incl. all deformers, etc connected to it), and the option to set position for the duplicate.

    I've never had a script dedicated to me before, it's defenitively worth a cookie ;)
Sign In or Register to comment.