View Full Version : Unity bakery
vncnt
10-24-2010, 01:29 AM
Ok, this was expected to go wrong for a new U3 user.
A simple walking figure animation using IK to position itīs legs.
I baked every single object in LW and exported to FBX using the LW9.6 internal FBX exporter.
Imported the FBX file into U3 and the result is that the legs are in the wrong position and are not animated anymore.
Also tried a version with deactivated IK settings. Same result.
There must be something very obvious that causes this.
Any ideas where to start debugging?
meshpig
10-24-2010, 03:36 AM
The fbx exporter has gotten worse imo not better though haven't tried it from Core. Most of the time it doesn't include the take let alone baking which it never has anyway.
Cheetah 3D and Silo are a pretty cheap combination for Unity. Silo has excellent UV tools which also export to LW via .obj and Cheetah, low brow as it is boots from Unity.
Despite Unity's appeal you can only do so much without immersing yourself in code, which I guess is why U3 indie is now free.
meshpig
10-24-2010, 03:37 AM
btw, the fbx file crashes cheetah.
vncnt
10-24-2010, 05:39 AM
Cheetah3D and Silo3D seem to be Mac only. Iīm using only XP/Win7 and would like to be able to export to all available platforms, including web and mobile.
Simple work: flipping a switch, activating panel lights, VU-meters, rotating objects, particles, etc. Unity seems to be able to handle that perfectly well.
After baking in LW I disabled IK. Boom! No more animation for the legs.
BTW Iīm using LW9.6 win32 and win64.
I noticed a few things.
1) Keyframer > Cycle(Bake)Keys didnīt bake anything at all.
2) Dopetrack > BakeAllZones only bakes for translation, rotation or transformation independently in the LW 64bit version. Unlike the 32bit version. A bug? So the legs rotation wasnīt exported to my FBX file anyway.
3) Dopetrack > BakeAllZones does not bake rotation caused by IK/pointAtTarget/poleItem. Both 32 and 64bit versions.
4) The Unity FBX export plugin for LW is 32bit only and the Unity FBX export plugin for LW does not include IK in the 32bit version of LW.
5) Additional > BakeMotion. Selected the body and then Error: BAKE_MODION.LS, Line 57, Index 0 invalid for array positions[0]. Are these plugins maintained at all?
6) By manually moving to the next frame (arrow right) and manually setting a keyframe for All Items (Enter + Enter) for all 102 frames I was able to "bake" keyframes.
Okay, now weīve got something to export.
Export FBX (LW32) and Export to FBX (Unity) plugin.
Imported both to Unity and both went wrong.
I need a drink...
EDIT:
7) "b" in Graph Editor also does not bake IK.
meshpig
10-24-2010, 08:05 AM
Cheetah3D and Silo3D seem to be Mac only. Iīm using only XP/Win7 and would like to be able to export to all available platforms, including web and mobile.
Simple work: flipping a switch, activating panel lights, VU-meters, rotating objects, particles, etc. Unity seems to be able to handle that perfectly well.
After baking in LW I disabled IK. Boom! No more animation for the legs.
BTW Iīm using LW9.6 win32 and win64.
I noticed a few things.
1) Keyframer > Cycle(Bake)Keys didnīt bake anything at all.
2) Dopetrack > BakeAllZones only bakes for translation, rotation or transformation independently in the LW 64bit version. Unlike the 32bit version. A bug? So the legs rotation wasnīt exported to my FBX file anyway.
3) Dopetrack > BakeAllZones does not bake rotation caused by IK/pointAtTarget/poleItem. Both 32 and 64bit versions.
4) The Unity FBX export plugin for LW is 32bit only and the Unity FBX export plugin for LW does not include IK in the 32bit version of LW.
5) Additional > BakeMotion. Selected the body and then Error: BAKE_MODION.LS, Line 57, Index 0 invalid for array positions[0]. Are these plugins maintained at all?
6) By manually moving to the next frame (arrow right) and manually setting a keyframe for All Items (Enter + Enter) for all 102 frames I was able to "bake" keyframes.
Okay, now weīve got something to export.
Export FBX (LW32) and Export to FBX (Unity) plugin.
Imported both to Unity and both went wrong.
I need a drink...
EDIT:
7) "b" in Graph Editor also does not bake IK.
Unity was mac only for yonks too... LW has never baked IK for fbx.
vncnt
10-24-2010, 11:26 AM
In retrospect, if baking IK is impossible, why didnīt LW just warn me for this?
warmiak
10-24-2010, 01:49 PM
In retrospect, if baking IK is impossible, why didnīt LW just warn me for this?
You don't need to even bake to properly export IK based animations ... there is nothing wrong with Lightwave (beside making it hard to obtain certain information within a plugin).
Your problem is with unity/fbx plugin ... just to test your scene I exported it with my own plugin/exporter for an iPhone based 3d engine (no baking , no special preparation just triangulating all objects) and it exported great ( it is another format I am exporting to but that's beside the point).
http://www.warmi.net/tmp/exporter.mov
meshpig
10-24-2010, 03:00 PM
You don't need to even bake to properly export IK based animations ... there is nothing wrong with Lightwave (beside making it hard to obtain certain information within a plugin).
Your problem is with unity/fbx plugin ... just to test your scene I exported it with my own plugin/exporter for an iPhone based 3d engine (no baking , no special preparation just triangulating all objects) and it exported great ( it is another format I am exporting to but that's beside the point).
http://www.warmi.net/tmp/exporter.mov
We know that...where's the plug in then?? :)
jasonwestmas
10-24-2010, 04:16 PM
What, no bone deformers or weight maps? I could be wrong but I've never seen any game engine that will import a file that doesn't have bones and skinning applied to the mesh in the animation package. Maybe try your walker with bones in it with weight maps applied.
warmiak
10-24-2010, 05:01 PM
What, no bone deformers or weight maps? I could be wrong but I've never seen any game engine that will import a file that doesn't have bones and skinning applied to the mesh in the animation package. Maybe try your walker with bones in it with weight maps applied.
IK != skeletal animation.
He is using node based animations which are perfectly fine for rigid objects.
Think of it as each mesh having a single bone with each vertex assigned to this bone.
jasonwestmas
10-24-2010, 07:23 PM
IK != skeletal animation.
He is using node based animations which are perfectly fine for rigid objects.
Think of it as each mesh having a single bone with each vertex assigned to this bone.
Sure, I know how LW looks at it but is it supposed to open in Unity that way? It certainly doesn't work with the 9.6 FBX exporter when I import it back into LW.
warmiak
10-24-2010, 08:53 PM
Sure, I know how LW looks at it but is it supposed to open in Unity that way? It certainly doesn't work with the 9.6 FBX exporter when I import it back into LW.
According to this page :
http://unity3d.com/support/documentation/Manual/HOWTO-importObjectLightwave.html
it should support both nodal and bone-based animations.
jasonwestmas
10-24-2010, 09:32 PM
Ah ok, well may-be then.
I couldn't get the exporter to work because valkarie only works with Joints. I forgot about that. Maybe that is true for nodal stuff too. I'll give it another try.
Also watch these videos:
http://rebelhill.net/html/lwandfbx.html
Not that you have to use a motion builder rig obviously.
jasonwestmas
10-25-2010, 09:29 AM
Different results this time but not really better. Here is a joint rig similar to the one Vncnt made. Yep, I have no idea why the FBX file won't import back into lightwave correctly. One of those LW features that isn't documented.
Something weird is that when I export the scene to FBX it deletes all my weight maps in the lwo file. :P
warmiak
10-29-2010, 09:42 AM
Ah ok, well may-be then.
I couldn't get the exporter to work because valkarie only works with Joints. I forgot about that. Maybe that is true for nodal stuff too. I'll give it another try.
Also watch these videos:
http://rebelhill.net/html/lwandfbx.html
Not that you have to use a motion builder rig obviously.
Yeah, that's probably part of it.
I am not familiar with joints ( they are represented in the SDK as good old bones ) but the way they transform seems to be different and your animation ( the one you posted ) doesn't export correctly.
It kind of looks almost ok but there is some translation added - legs are way off.
I bet that great majority of exporters only work with z-bones.
jasonwestmas
10-29-2010, 10:26 AM
I bet that great majority of exporters only work with z-bones.
Thanks for taking a look.
I'm just wondering why do Motion Builder Files work with Joints but I can't export and import a simple joint leg animation? I couldn't even get the joints to move in the FBX file.
warmiak
10-29-2010, 10:42 AM
Thanks for taking a look.
I'm just wondering why do Motion Builder Files work with Joints but I can't export and import a simple joint leg animation? I couldn't even get the joints to move in the FBX file.
Have you tried remaking this simple scene with z-bones to see if that works ?
jasonwestmas
10-29-2010, 10:45 AM
Have you tried remaking this simple scene with z-bones to see if that works ?
Yes. . . I get the zbones to move in the FBX import but they are all jumbled. Baking doesn't fix the issue. I only tried Joints because I've been told that the Valkarie FBX plugin is designed to work with Joints only.
warmiak
10-29-2010, 10:48 AM
Yes. . . I get the zbones to move in the FBX import but they are all jumbled. Baking doesn't fix the issue. I only tried Joints because I've been told that the Valkarie FBX plugin is designed to work with Joints only.
Would you be able to post the same scene here with z-bones instead ?
I am trying to figure out what is the difference in the SDK in terms of bone/transformations...
jasonwestmas
10-29-2010, 11:36 AM
Would you be able to post the same scene here with z-bones instead ?
I am trying to figure out what is the difference in the SDK in terms of bone/transformations...
Sure, here ya go. Note that both the IK manipulators and bones have keyframes. I can delete the bone keyframes if you want.
vncnt
10-29-2010, 11:45 AM
Last week Iīve sent a mail to NTīs helpdesk about this issue.
A part of my latest e-mail to Josh:
"To check if IK-export to FBX was supported by LW9.6 at all I created a test scene in LW with three simple cubes, see also attachment.
When exported to FBX (1x with and 1x without baking), using the internal FBX exporter, and reloaded the FBX files into LW, both imported FBX files showed cubes without any motion. Only the IK-target is moving.
I think this proves that IK-motion is not exported to FBX by LW9.6 or IK-motion cannot be retrieved from FBX files.
I think I also proved that IK-motion is not baked to keyframes by LW in any way. Tried Keyframer, Dopetrack, BakeMotion, GraphEditor, MotionBaker and CreateMotionKey.
When exporting IK-motion from LW to Unity it seems to be essential that LW can bake IK-motion to keyframes to bypass IK difficulties in the FBX exporter
or the FBX exporter should be able to translate IK-motion to FBX files without baking at all."
To be continued ....
warmiak
10-29-2010, 11:45 AM
Sure, here ya go. Note that both the IK manipulators and bones have keyframes. I can delete the bone keyframes if you want.
Yeah, if you could please.
I my code I don't make any assumptions about prebaked frames ( in other words, I install a motion tracker type of plugin to gather post-ik info to capture real time IK without baking)
Thanks
jasonwestmas
10-29-2010, 12:10 PM
Okay, here is the same scene without keyframes on the bones, only the manipulator objects have keys.
warmiak
10-29-2010, 12:14 PM
Okay, here is the same scene without keyframes on the bones, only the manipulator objects have keys.
Thanks :-)
jasonwestmas
10-29-2010, 01:01 PM
Yeah, I hope you figure out something :)
Another thing I noticed about Valkarie is that it ignores my weight maps and makes it's own version of "smooth skin" weights based on all the object names in the scene. Which is a no-go in the video game world and it doesn't work for a rigid body robot obviously.
jasonwestmas
10-29-2010, 01:11 PM
Last week Iīve sent a mail to NTīs helpdesk about this issue.
A part of my latest e-mail to Josh:
"To check if IK-export to FBX was supported by LW9.6 at all I created a test scene in LW with three simple cubes, see also attachment.
When exported to FBX (1x with and 1x without baking), using the internal FBX exporter, and reloaded the FBX files into LW, both imported FBX files showed cubes without any motion. Only the IK-target is moving.
I think this proves that IK-motion is not exported to FBX by LW9.6 or IK-motion cannot be retrieved from FBX files.
I think I also proved that IK-motion is not baked to keyframes by LW in any way. Tried Keyframer, Dopetrack, BakeMotion, GraphEditor, MotionBaker and CreateMotionKey.
When exporting IK-motion from LW to Unity it seems to be essential that LW can bake IK-motion to keyframes to bypass IK difficulties in the FBX exporter
or the FBX exporter should be able to translate IK-motion to FBX files without baking at all."
To be continued ....
Thanks for contacting NT. Did you send them a link to this thread?
jasonwestmas
10-29-2010, 08:15 PM
Here's something that works with Baking IK. I discovered some things I was doing wrong, things I didn't realize would be an issue when rigging and skinning for FBX.
I used the "fbxlw80-53" plugin for LW8 and it worked fine in 9.6. At least it works when importing the FBX file back into LW. Haven't tried to get the FBX file into Unity yet but this is real progress with an old AD plugin inside of LW 9.6.
So here is a video and scene files. Hope this helps us out.
http://www.sendspace.com/file/ubybej
jasonwestmas
10-29-2010, 10:27 PM
I found a problem with the Right Hip Axis when I opened the FBX file in Houdini. These files should work better. Houdini file is included.
vncnt
10-30-2010, 07:37 AM
Thanks for contacting NT. Did you send them a link to this thread?
Yes, although Iīm not convinced they read them all.
I also attached the simple IK-cube scene to this post.
warmiak
10-30-2010, 12:42 PM
Hey Jason.
I was playing with you Walker_Zbones_NoBake.zip model and there are some problems with the model itself.
Namely your weights assignment needs some clean up.
If you enable "weight normalization" for all bones with weights (which you should have always on when exporting to Unity or other game engines), things get a bit misaligned in the layout app, which suggests to me that you have some bone assignment totals which go over 100% ( and for this model it should never happen)
I don't think this is the source of your problems but at least in my case in resulted in slightly incorrect animations outside of Lightwave.
Another thing .. your model somehow ends up with every vertex being assigned to every bone (albeit with 0% weight value for other bones) which can trip some exporters ( as the SDK will report these values as valid bone assignments )
jasonwestmas
10-30-2010, 01:15 PM
Thanks for letting me know about that. Some exporters don't like weight normalization I think but I'll try it with that on. Every weight map that I assigned has a value of 0 or a value of 100, nothing in between that. Some of the bones are sharing the noweight weight map, maybe that is causing the problem. I'll make sure each bone has a different weight map.
Which exporter are you using? Valkarie I presume.
warmiak
10-30-2010, 01:55 PM
You can't really tell it visually in the modeler app but for instance COG(1) weight has non-zero weight assigned to it for every vertex ( sometimes it is simply something like 0.012 or so ) which , for instance my own exporter detected as a valid weight value and thus ended up exporting every vertex with 2 bone assignments.
It won't probably make much difference in terms of actual vertex weighting during animation but it does make a difference when exporting to game engines ( if only in terms of the overall model size)
As far as weight normalization ,it is generally always required when exporting to a game engine ( some exporters will renormalize weigths for you) because skeletal animation algorithms depend on these values being normalized.
Of course, if you assign your weights correctly, always making sure that totals add up to 100 % then it won't make any difference but I always keep it on simply as a safety measure.
Having this on should never interfere with your exported animations and if it does then there is something wrong with weight assignments to begin with.
I am using my own exporter ( which exports to a different format) but I am working on creating another version , which exports to FBX ( using Autodesk’s own SDK.)
Anyway, the hard part was with correct transformations ( different axis ordering with Unity/OpenGL ES), real-time IK capturing, exporting rest positions/rotation etc ... it is all mostly done , now I am just trying to debug some bugs in my code with weight assignments.
jasonwestmas
10-30-2010, 02:04 PM
You can't really tell it visually in the modeler app but for instance COG(1) weight has non-zero weight assigned to it for every vertex ( sometimes it is simply something like 0.012 or so ) which , for instance my own exporter detected as a valid weight value and thus ended up exporting every vertex with 2 bone assignments.
It won't probably make much difference in terms of actual vertex weighting during animation but it does make a difference when exporting to game engines ( if only in terms of the overall model size)
As far as weight normalization ,it is generally always required when exporting to a game engine ( some exporters will renormalize weigths for you) because skeletal animation algorithms depend on these values being normalized.
Of course, if you assign your weights correctly, always making sure that totals add up to 100 % then it won't make any difference but I always keep it on simply as a safety measure.
Having this on should never interfere with your exported animations and if it does then there is something wrong with weight assignments to begin with.
I am using my own exporter ( which exports to a different format) but I am working on creating another version , which exports to FBX ( using Autodesk’s own SDK.)
Anyway, the hard part was with correct transformations ( different axis ordering with Unity/OpenGL ES), real-time IK capturing, exporting rest positions/rotation etc ... it is all mostly done , now I am just trying to debug some bugs in my code with weight assignments.
Very nice, I would love to try out the exporter when you are ready. Thanks. I'll post some other scenes with your recommendations.
Edit: Ohhhhhh I remember, I need to first apply a weight value of '0' to every vertex the weight map isn't going to use. I think that is why you are getting a value on every vertex for a single map.
jasonwestmas
10-30-2010, 02:43 PM
Hey Warmiak, give this setup a try. If we get the same issues I didn't do anything significant ;) Do you think 0% weightmaps are causing any issues? I use them because I don't want some bones to have any influence over the mesh.
warmiak
10-30-2010, 04:31 PM
Hey Warmiak, give this setup a try. If we get the same issues I didn't do anything significant ;) Do you think 0% weightmaps are causing any issues? I use them because I don't want some bones to have any influence over the mesh.
I don't think 0% weightmaps are causing problems here ... just something I noticed was tripping my exporter :-) so don't worry about it - it was a false alarm ( beside weigthmaps problems generally are quite recognizable - i.e your mesh starts "tearing apart" as if it was made out of cloth here is an example : http://www.warmi.net/tmp/exporter3.mp4)
In any case, I fixed that issue ( essentially 0% should have no influence over anything but if my code was tripping on it, perhaps other exporters are as well)
As far as creating 0% weightmaps then you shouldn't have to do that anyway.
In general rules for exporting animations to games are:
1. Always make sure to have "use weigths only" set to true. This is the most important rule.
2. Don't create any bones which have no weight values as they have potential to affect your mesh ( if they are active) in ways which won't be replicated in your exported model as the only "portable" way to do that is thru weights - all these cool settings like bone strength etc are Lightwave specific and have no meaning outside of it. If you need other controllers in between bones - use nulls only.
I am still debugging things here but I can tell you that to make things work I had to put rest position/rotation at frame 0 , collapse some nodes etc ... ( this is all done within the plugin so there is no need to modify the scene at all)
Your animation is pretty much the only one not exporting correctly right now - it is getting there but there is something going on with both feet.
Here's how it looks right now :
http://www.warmi.net/tmp/exporter2.mp4
jasonwestmas
10-30-2010, 05:15 PM
Is your exporter designed to bake the motion automatically to each bone? How does it translate IK into bone data??
"1. Always make sure to have "use weigths only" set to true. This is the most important rule."
In the latest scene use weights only and weight normalization are true for all bones.
"2. Don't create any bones which have no weight values as they have potential to affect your mesh ( if they are active) in ways which won't be replicated in your exported model as the only "portable" way to do that is thru weights - all these cool settings like bone strength etc are Lightwave specific and have no meaning outside of it. If you need other controllers in between bones - use nulls only."
So is what you are saying that I need to use a null as an IK goal instead of a bone? Is that how your exporter works? In my latest setup I'm using the foot bone as the goal for the ankle bone. Does that matter?
warmiak
10-30-2010, 05:56 PM
Is your exporter designed to bake the motion automatically to each bone? How does it translate IK into bone data??
In a sense ... it bakes IK keyframes internally for the purpose of exporting them but it doesn’t modify your scene in any way. In other words, it is an equivalent of baking all IK info into keyframes for all bones (and other nodes which use IK) but all of that is happening in memory without actually storing anything into Lightwave’s own keyframes so your scene remains intact.
There is no other way to capture IK data, except forcing people to bake their IK animations manually ( using some other plugin or something) before exporting animations.
So is what you are saying that I need to use a null as an IK goal instead of a bone? Is that how your exporter works? In my latest setup I'm using the foot bone as the goal for the ankle bone. Does that matter?”
That’s fine. What I mean to say is that if you use helper bones without weights just make sure that they are only used to transform/position other bones/nulls etc .. and not to deform the mesh itself.
Frankly, this has nothing to do with the way my exporter works but rather with the fact that the only way to animate a mesh outside of Lightwave ( i.e in a game engine ) is thru weighted bones ( generally exporters will use all scene items (nulls,helper bones) to calculate final positions for weighted bones and in the end only export weighted bones anyway )
jasonwestmas
10-30-2010, 07:50 PM
Hmm, I'm not sure why that last scene didn't export the IK correctly then in your little movie. Far as I know I have everything setup correctly.
warmiak
10-30-2010, 07:57 PM
Hmm, I'm not sure why that last scene didn't export the IK correctly then in your little movie. Far as I know I have everything setup correctly.
Don't worry about it - your scene appears to be fine, it is most likely a bug in my exporter ... I am still debugging it.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.