PDA

View Full Version : Holy Grail...? Bake Mograph objects to keyframes


ChrisCousins
03-17-2009, 11:12 PM
Hi all - after the holy grail it seems - is there a way to bake mograph-based motion into keyframes, so the animation can be exported for external rendering.

Sounds simple enough but I've just searched and it's been asked a bunch of times within different threads and I can't see that anyone has solved it.

I've got as far as constraining independent objects to follow the clones in this thread (http://forums.cgsociety.org/showthread.php?p=5747998), although it seems Per solved that part of it ages ago here (http://forums.cgsociety.org/showthread.php?f=47&t=376643&page=2&pp=15). But baking any of these objects in the timeline doesn't give keyframes, just duplication.

Hope someone can help! Thanks - Chris

mikeh64
03-17-2009, 11:30 PM
when you say "external rendering", do you mean net render?

Keith Young
03-17-2009, 11:45 PM
You might be able to export a sequence of .obj files with the latest Riptide Pro, if that does you any good (you can try it with the demo if you haven't used up the 30-day trial or if you can send me or post a link to a simple scene to test this with, I can try it and let you know if it works, but I think it should).

Horganovski
03-17-2009, 11:46 PM
I haven't tried this and it's a messy idea, but maybe worth a try.

What about creating a 3rd set of objects, the 1st set are controlled by the cloner, fracture object etc. the 2nd set use the xpresso to follow those, and the 3rd set use PSR constraints to follow the 2nd set.. pretty messy as I said, but if you bake the 3rd set with the constraints on them it might see their positions/orientations propery.

As I said I haven't tried this.. just thinking out loud here..

Cheers,
Brian


EDIT - Scratch that - just tried it and it doesn't work:sad: (at least in 10.5 anyway)
I agree it's silly that this is so difficult.

ChrisCousins
03-18-2009, 12:51 AM
when you say "external rendering", do you mean net render?

Hey Mike - I mean in modo in this case, but really any other app that takes .fbx format, so Max, Maya etc could use a method.

Keith - I've not tried this yet, it's a good plan though - but I'd then have to clean up and texture the individual frames in modo which would be a drag...

Brian - thanks, that occurred to me too, but something stops the keyframes being baked - it's odd as baking before now has something that just 'always works'.

wim
03-18-2009, 01:24 AM
Hi there,

It would also be great to be able to import mograph-based motion into game-engines, like Unity3d. Here you also need keyframes and the FBX format.

bandini
03-18-2009, 03:05 AM
I have done this before to render mograph clones in 3DS Max - no holy grail at all, but a small bit of work.

You link a duplicate set of objects to the mograph clones via Xpresso. Let's say you have a system with 300 cloned cubes... Create 300 cubes and put them in a null. Use iteration + link list nodes (+ mograph data node) to make the non-mograph cubes bind to the mograph cubes. Then, select all the non mograph cubes and turn on record for all PRS, then press the keyframe button. Advance the time slider one unit and press keyframe again, etc. I have a script that automatically does this, but I can't find it right now...

You can then export via FBX, and all PRS data should work correctly.

Horganovski
03-18-2009, 03:30 AM
That script sounds very useful if you manage to find it again.. a potential way to avoid RSI when doing something like this ;)

I don't know that much about Coffee but I guess the guts of it would a For loop that repeats for the duration of the number of frames in the scene, then inside this loop you put a Record Active Objects command followed by a Next Frame command.

Hmmm maybe I'll have to try and figure this out for myself as a learning exercise.. I'll post my results if I get it working.

Cheers,
Brian

Horganovski
03-18-2009, 03:41 AM
Hey I just found another way to do it, a little slow as you'd have to do one object at a time but it works.

Set up the xpresso as before, cache the mograph object using a mograph cache tag. Then select an object you want to bake and choose the Mocca Cappucino tool. Click on Start Realtime and then click on any of the translate arrows of the object to be baked, hold the mouse button down but don't move the mouse. The animation will play through and the object gets baked properly. Repeat for the other objects.

A bit of a hack but it does work.. the script to bake would definitely be neater.

Cheers,
Brian

Horganovski
03-18-2009, 04:01 AM
Man why did I ever read this thread? :)

I have a really simple script now that cycles through the timeline for 50 frames and records a key on each one.. but the result is the same as baking with the PSR constraint.. I tried adding in a Redraw command but still the same..

var count = 1;
while (count<50) {

CallCommand(12410);//Record Active Objects
CallCommand(12414);//Next Frame
count++;
}

Cheers,
Brian

bandini
03-18-2009, 05:04 AM
Here it is...

No fancy controls or GUI here - all parameters are accessed through the script editor. You need to select the objects to bake and make sure to enable all Position, Rotation, and Scale keyframe options before running this script:


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);
}

bandini
03-18-2009, 05:11 AM
Here is also a .c4d file that shows how to link objects to mograph clones:

Link (http://www.adamswaab.com/mograph/bake_object_positions_01.c4d.zip)

Horganovski
03-18-2009, 05:20 AM
Works perfectly.. many thanks.. now I can get on with my life :)

Cheers,
Brian

ChrisCousins
03-18-2009, 09:26 AM
Here it is...

Here it is indeed - works perfectly, huge thanks this has opened a whole load of doors for me, I owe you one :beer: guess I need to start looking into scripting, that's some pretty useful stuff in there.

ChrisCousins
03-18-2009, 10:04 AM
Man why did I ever read this thread? :) Brian

Thanks to you Brian too for the time, hope you'll find this as useful as I will!

Cheers - Chris

govinda
03-18-2009, 03:02 PM
Someone ought to stick this into the Scripts section with a huge bullet, right next to Per's clones-to-nulls script.

Horganovski
03-18-2009, 03:03 PM
Thanks Chris, I'm sure I will!

Cheers,
Brian

ThePriest
03-18-2009, 04:14 PM
Nice solution

wim
04-01-2009, 11:45 AM
That's really great, thanks a lot!

dieGolum
02-09-2010, 09:15 AM
Here is also a .c4d file that shows how to link objects to mograph clones:

Link (http://www.adamswaab.com/mograph/bake_object_positions_01.c4d.zip)

Hello,
I'm trying to get this .c4d file but the link does not seem to work, please could someone re-upload it or send it by email?

Thanks in advance

Diego

bandini
02-09-2010, 07:07 PM
I just switched web hosts, so that link may have been removed when I cleaned out my old folders. I'll see if I can find it and re-upload.

JeremyW
02-09-2010, 09:30 PM
I just switched web hosts, so that link may have been removed when I cleaned out my old folders. I'll see if I can find it and re-upload.
Yes please.

bandini
02-10-2010, 12:14 AM
Link is back up.

dieGolum
02-10-2010, 08:11 AM
Link is back up.

Thank you very much Baldini, here trying to export Mograph animations to EIAS (Electric Image).

Cheers

Diego

CGTalk Moderation
02-10-2010, 08:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.