I am working with the Maya exporter (Maya2022) Babylon version 1.6.0. It’s been great so far, I have just run into one problem.
I have a scene with several meshes that all have both bone and morph animations on them.
Everything exports fine, but when I add animation groups only one morph animation is exported.
All of the morphs are still exported but the animation keys are only exported for one mesh.
I have created 2 gLtf files to show an example of this, both are exported from the same Maya scene:
One has 1 animation group (and only one morph animated).
The other has no animation groups and all morphs are working as expected.
Is there some way to export all of the morphs and still have the animation groups?
The scene I have will have over 100 meshes in it so it’s not really feasible to export them individually.
I’m not sure I understand the problem, but I think it’s an export problem at the Maya level?
I played both files in Threejs glTF viewer and in the Sandbox, and the result was the same, so I guess the problem is on the export side => let’s ask @PatrickRyan, for whom Maya holds no secrets!
@Pearse, I can repro your issue. From what I can gather, there is a bug in the code that gathers animation data from morph targets in the scene. It succeeds on the first and then fails for all other morph targets in the scene. If you enable
Export non-animated node targets we bypass that part of the code and get all morph target animations within a group. This is a work around for now. I will open a bug on the exporter.
@Pearse, bug is filed 3ds Max not exporting morph target animation when using animation groups · Issue #1093 · BabylonJS/Exporters (github.com). I don’t have any visibility on when we can address this as we aren’t funding active development on new features or support for new versions. We are fixing bugs in the existing exporters, but don’t have dedicated resources for it so we will have to find a way to fit this in. In the meantime, use the workaround to unblock you and hopefully it won’t cause any other optimization issues.
Thanks for getting back to me so quickly Patrick.
Unfortunately exporting the non-animated node targets seems to have some unexpected results with the joints I have in my scene. I am going to try an build awork around, It doesn’t look like autodesk are going to build an exporter any time soon.
For anybody who finds this post struggling with the same issue; The morphs are being exported but the animation data is not. You should be able to create a locator and plug the value of the morph target directly into the, say TranslateX. Then when you export the file (make sure to bake animations) you might be able to use the translateX to drive the corresponding morph.
We are doing it with a proprietary engine so I have the benefit of having a developer to help me try build a work around, but you may be able to do something in Blender.
@Pearse, I can say that your work around is one that I have used in the past in a production 3D product. We used locators to drive animation of a lot of values from shaders and more. The one thing I would caution is that every locator will live in the scene as an abstract mesh. This will increase the number of meshes in scene and could cause some performance issues.
One thing you may want to do is to move all locators you are using to drive animation properties to another parent that sits in one place in the scene and does not move. The locators you import with your glTF will sit within the root hierarchy in scene and will need to be updated whenever that root node is moved, scaled, or rotated. Moving these to a different parent will help reduce any extra updates to these meshes that could happen if left in their original hierarchy.