PDA

View Full Version : New LScript: Motion baker... that works :)



MentalFish
09-24-2009, 12:46 PM
I have created a new baking script that handles baking of multiple items as well as stuff done with DP Kit + Node Item Motion

Give it a spin:
http://mentalfish.com/2009/09/motion-baker/

Update: Added GUI for input of start and end frame to bake.

probiner
09-24-2009, 01:47 PM
Hmmm... i'll have to see this =)

But you could have provided a very simple sample scene file to illustrate the limits of the plugin to start with :P

Cheers

MentalFish
09-24-2009, 01:57 PM
Hey cageman, provide us with some troublesome scenes to try! :hammer: :D

Cageman
09-24-2009, 02:02 PM
Sure.... I'll put something together!

omichon
09-24-2009, 02:10 PM
Thanks Petter ! I will give it a chance...hope this one is the good one.
I already have tried a couple of scripts supposed to do this job, but none of them is working in all situations 8~

tyrot
09-24-2009, 03:17 PM
dear mentalfish

thanks for the plugin..

if cageman is your betatester then you are in good hands:) He really does fantastic stuff and cool videos..

come on cage, waiting for full video tutorial ..nuts and bolts for that .. I am happy that you are working together on LW plugs. Good plugins i sense in the 3D space:)

Best

MentalFish
09-24-2009, 06:07 PM
I have been adding features and breaking some it seems this evening. Will get back to it soon. Same download link as earlier, so watch those browser caches. Make sure you have the one with a GUI to select which channels to bake. Any and all feedback welcome.

adk
09-24-2009, 08:25 PM
Cheers MentalFish ... will definitely have to play with this :thumbsup:

MentalFish
09-25-2009, 05:21 AM
Problem fixed, I needed to add RefreshNow() to make sure the script reads the correct "state of things", so to speak.

Cageman
09-25-2009, 02:25 PM
Problem fixed, I needed to add RefreshNow() to make sure the script reads the correct "state of things", so to speak.

What MentalFish refers to is a limitation with Node Item Motion. Whenever you use it, you will always see a 1 frame delay when doing previews and such things. The only time it will match 100% is either when rendering, or if you force LW to update. How do you do force LW to update? Well, select another item may force Node Item Motion to do a full evaluation and make things pop into place, another way is to open any node editor and that should also force Node Item Motion to update.

The legacy Motion Baker motion modifier suffers from the fact that it doesn't evaluate Node Item Motion fully, and, to be honest, baking directly to the object instead of extra channels (feature within Motion Baker motion modifier) almost always results in a mess. So, not only do you have to bake to those extra channels, you then have to manually copy each of these extra channels to the appropriate real channel, and after that you need to offset all channels -1 frame to get an exact match. Do this with more than three objects and you are starting to get crazy... I usually have at least 20 objects and so far, I have always had to resort to some manual tweaking... ALWAYS! *sigh*

ALL of this is now taken care of by MentalFish's magnificent L-Script, and I believe there is at least one UI-tweak still, to make it even better, workflow wise.

Testcontent scenes will be provided soon enough... just keep track on this thread.

:)

MentalFish
09-27-2009, 01:59 PM
As cageman mentioned, improved workflow was on the way and here it is. You can now click a toggle button for all three axis and/or toggle them one by one. Another addition is the ability to skip frames when baking so you can create a key every n'th frame.

serge
09-28-2009, 07:54 AM
Great! Thanks MentalFish!

serge
05-14-2010, 04:02 PM
I have an object simply following a null (parent), but I can't seem to bake the motion. It does work when I use Dpont's Node Item Motion to have the object follow the null. Any ideas? (LW 9.6, WinXP Pro 32bit)

Thanks again for this plugin Mentalfish. It's great being able to bake motions from Node Item Motion.

MentalFish
05-14-2010, 04:37 PM
Hmm.. I think I need to change the title of it :D

I'll look into it, might be something about parented objects it does not like.

Cageman
05-15-2010, 03:39 AM
I have an object simply following a null (parent), but I can't seem to bake the motion. It does work when I use Dpont's Node Item Motion to have the object follow the null. Any ideas? (LW 9.6, WinXP Pro 32bit)

Thanks again for this plugin Mentalfish. It's great being able to bake motions from Node Item Motion.

The difference between a parented object and a constrained object (node item motion) is that the constrained object exists in worldspace and must retain worldspace coordinates when following. A parented object relies on what the parent is doing; the object exist in parent space. The "world" for that object is its parent, and therefore it relies on what the parent is doing. You can not bake that motion, because it doesn't make any sense at all to do that.

I'll make a short video describing this. Hold on.. :)

Cageman
05-15-2010, 04:17 AM
LINK to videos! (ftp://LightWave:[email protected]:21/Cageman_Worldspace_vs_Parentspace)

serge
05-15-2010, 08:40 AM
Thanks Cageman. Yes, you're right about it not making sense. I was merely testing MFMotionBaker to see what is possible.


... You can not bake that motion, because it doesn't make any sense at all to do that...
Well, actually you can bake that motion with native Motion Baker, but it seems to mess it up. So I was checking if it might work with MFMotionBaker. But like you said, there's probably no situation where this would be useful.

Thanks for the video! :)

serge
05-21-2010, 09:38 AM
... You can not bake that motion, because it doesn't make any sense at all to do that.
Actually, I think I do know a reasonable situation where baking that motion makes sense, namely in the case where the child has an offset from the parent.

Simple example: create a null, create a child null, offset the child null's position, animate the parent's rotation. Obviously, copying the motion from the parent to the child will not work in this case. Native Motion Baker does bake the motion, but not correctly. Mental Fish Motion Baker doesn't seem to bake the motion at all.

We have the Node Item Motion workaround, but it would still be nice if Mental Fish' plugin would be able to do this without Node Item Motion. (Don't know if it's possible, but the fact that native Motion Baker does something gives me hope. :))

Cageman
05-21-2010, 10:25 AM
Actually, I think I do know a reasonable situation where baking that motion makes sense, namely in the case where the child has an offset from the parent.

Simple example: create a null, create a child null, offset the child null's position, animate the parent's rotation. Obviously, copying the motion from the parent to the child will not work in this case. Native Motion Baker does bake the motion, but not correctly. Mental Fish Motion Baker doesn't seem to bake the motion at all.

We have the Node Item Motion workaround, but it would still be nice if Mental Fish' plugin would be able to do this without Node Item Motion. (Don't know if it's possible, but the fact that native Motion Baker does something gives me hope. :))

Well... where do you want the child null to end up after baking? Because, as long as it is in parent space, it will still be forced to obay what the parent is doing. The only reason to bake children with a tool like Motionbaker or MF Motionbaker, is if you want to transfer what the child is doing into worldspace, disconnecting it from the parent; hence the reason why you need to have a worldspace object to recieve what the child is doing (and that is what Node Item Motion does, for example).

serge
05-21-2010, 12:34 PM
Well... where do you want the child null to end up after baking? Because, as long as it is in parent space, it will still be forced to obay what the parent is doing. The only reason to bake children with a tool like Motionbaker or MF Motionbaker, is if you want to transfer what the child is doing into worldspace, disconnecting it from the parent
For example in case I want to save the motion, for whatever use (as input for a node, whatever).


...you need to have a worldspace object to recieve what the child is doing (and that is what Node Item Motion does, for example).
Like I said, native Motion Baker does bake the child motion, so obviously it gets the info from somewhere. It just does a bad baking job. Perhaps Mental Fish can fix this, and then we can skip the Node Item Motion workaround.

MentalFish
05-21-2010, 01:22 PM
MF Motion Baker, bakes out all selected items. If you want to bake a child item, make sure its selected. Shouldn't be more to it.

serge
05-21-2010, 02:57 PM
MF Motion Baker, bakes out all selected items. If you want to bake a child item, make sure its selected. Shouldn't be more to it.
No, doesn't work for me. (LW 9.6, tried on 2 different PC's.) It does create keyframes, but doesn't bake the motion. (Sorry for stating the obvious, but be sure to unparent the child again to check if the motion has been baked, or check the graph editor.)


Edit: Does it work for anyone else, except Mental Fish? ;)

Cageman
05-22-2010, 04:11 AM
What MotionBaker does is that it gets confused because you are using it in a situation it is not designed to resolve.

I'm still at loss to understanding what it is you are trying to achive with baking the motion of something that is driven by the parent, if putting in worldspace isn't what you are after.

Cageman
05-22-2010, 04:16 AM
No, doesn't work for me. (LW 9.6, tried on 2 different PC's.) It does create keyframes, but doesn't bake the motion. (Sorry for stating the obvious, but be sure to unparent the child again to check if the motion has been baked, or check the graph editor.)


Edit: Does it work for anyone else, except Mental Fish? ;)

Please, understand that what you are talking about doesn't make sense, so make it make sense. Why do you want to bake a child and what is the gain for that? I really need a solid example here! I mean, if a child is driven by the parent (which it is if it is parented), you do not have to bake its motion, because the motion you apply to the parent will obviously affect the child. The relationship between a parent object and a child object is no different from a bonechain where you have the elbow bone parented to the upper arm bone.

serge
05-22-2010, 06:51 AM
... if putting in worldspace isn't what you are after...

...what is the gain for that? I really need a solid example here!
:)
But world space is what I'm after. I gave the example of wanting to save the motion path of a child which has an offset from the parent. (This motion path could then for example be used as data for a node.)


What MotionBaker does is that it gets confused because you are using it in a situation it is not designed to resolve.

I considered that. However:


If you want to bake a child item, make sure its selected. Shouldn't be more to it.
I'm not trying to be stubborn here. I understand the point about parent space vs world space. But perhaps there's internally some 'smart' coding where Motion Baker indeed tries to track and bake the child's motion, but fails because it doesn't work well.

Cageman
05-22-2010, 10:34 AM
Well... what MentalFish says is that you can bake child items. Lets say your childitem animation is driven by Node Item Motion + its parent, selecting the child and bake it would mean that you can get rid of node item motion. The parents movments, however, are not baked since, as we have established allready, for the child, the parent movement = the world movement. In order to get that data out into worldspace, you have to add an object that is placed in worldspace, constrain it to the child item and then bake the worldspace object. There is no other way to do it.

serge
05-22-2010, 11:36 AM
... you have to add an object that is placed in worldspace, constrain it to the child item and then bake the worldspace object.
But for Node Item Motion, and Follower as well, to be able to constrain an object to a child item's motion, they somehow have to translate that motion into world space coordinates, no? If those plugins can do it then maybe a 'smart' motion baker can also do that internally, without having to add an object.

Cageman
05-22-2010, 01:05 PM
But for Node Item Motion, and Follower as well, to be able to constrain an object to a child item's motion, they somehow have to translate that motion into world space coordinates, no? If those plugins can do it then maybe a 'smart' motion baker can also do that internally, without having to add an object.

Yes... if you constrain an object to a child item using Node Item Motion, you can see the worldspace coordinates on the constrained object. The reason why it happens is because the object (the constrained object) is in worldspace, and can not know anything about the parent space where the child object is. Simply put, the world coordinate object (the constrained object) sees a point in space that it follows. It does not know (or care) if it is another worldspace object or a child etc.

The crux here is that the tool you are suggesting have to have something that can relate to worldspace and parent space at the same time, bake or store the worldspace coordinates as channel data somewhere internaly in memory, and then execute an unparent command to the child object and apply the motion to the child when it has been moved into worldspace.