January 14, 2010

Bake Mograph

There is a workaround to bake MoGraph (including dynamics):

- duplicate your Cloner / Fracture Object
- hit "C" to convert the Cloner to single objects
- put a XPresso Tag on the converted Cloner which attaches every "physical" copy of your objects to its cloned counterpart (screenshot of XPresso attached)
- set the priority of the XPresso Tag to "Generator 499"
- be sure you have the converted Cloner selected in ObjectManager (the Null that contains all your "physical" copies)
- go to Character - Cappucino
- select "Rewind Time", "Position", "Rotation" and "Hierarchy"
- hit "Start Realtime"
- Click and hold anywhere in your editor view until the animation has run through once

You've got your baked to keyframes MoGraph. If you save the XPresso as a preset it's not that hard or lengthy to do at all. Actually it's something of a 30sec job to bake your MoGraph if you've got the XPresso ready to go.

And here's the Screenshot of the whole setup. Couldn't attach it here because of filesize limit.









var userStartTime = 0;
var userEndTime = 90;

var fps = doc->GetFps();
var bakeStartTime = GetActiveDocument()->GetTime(); //needed to initialize a BaseTime object
bakeStartTime->SetFrame(userStartTime, fps);

doc->SetTime(bakeStartTime); //set the time slider to the user's start time
var currentFrame = GetActiveDocument()->GetTime()->GetFrame(fps);

while(currentFrame <= userEndTime)
{
StopAllThreads();
CallCommand(12410);//record
userStartTime++;
bakeStartTime->SetFrame(userStartTime, fps); //needed to convert frame to BaseTime
doc->SetTime(bakeStartTime);//SendPlayhead to next frame
var redraw = DrawViews(DA_STATICBREAK);
EventAdd(EVENT_ANIMATE);
if(redraw == TRUE) currentFrame = GetActiveDocument()->GetTime()->GetFrame(fps);
}





BY Adam Swaab

7 comments:

  1. Worked great. Just what I needed to take a modynamic sim into realflow. Thanks so much.

    ReplyDelete
  2. Works like a charm - but how would you do it with a fracture object that contains 20, 30 elements or more?

    ReplyDelete
  3. You might have to put all the fractured pieces inside a cloner Object, then set the mode to Grid array and then add the number of fractured pieces only on one axis. Then that should do it. Then you can do the rest with Xpresso. email me if you have any problems.

    ReplyDelete
  4. Hey Jorge

    Thanks for the post. I'm also trying this with a fracture object and hit a snag.

    When you say "You might have to put all the fractured pieces inside a cloner Object, then set the mode to Grid array and then add the number of fractured pieces only on one axis"
    Do you mean take the pieces out of a fracture object first? Would the cloner grid not change the start position of the fractured pieces? I'm exploding a bottle with modynamics so its very important that pieces start as a complete and perfect bottle.

    I look forward to your response

    ReplyDelete
  5. Here is an example of what i was talking about
    http://jorgelega.com/Fracture_Example.c4d

    ReplyDelete
  6. Hi Jorge, thanks for this, extremely helpful.

    Question: my cloner "count" (number of clones) is animated, and this doesn't get reproduced with this method. Do you have any idea of how to work this out?

    Thanks a lot!!!
    Dan.

    ReplyDelete
  7. HI. just came across this & was wondering if it is possible to use the above setup in conjunction with effectors. I have a scene that i'm looking to export to a game engine & then texture inside the game engine. So essentially it is baking a mograph scene that has multiple cloners & effectors in the scene. Anyone know if this is possible?

    ReplyDelete