Exporting animation groups from 3ds Max to gltf not working properly

When I export the whole animation I have created from 3ds Max to gltf everything exports fine and runs exactly as it should in the babylon sandbox viewer. When I set a series of animation groups and export to gltf only some of the animation groups have all of the added models while other animation groups are missing some models or all of them.

I have tried a number of different settings such as selecting ‘export non-animated node targets’ and (Animations Groups) Export non animated objects but the problem still remains.

When I select ‘do not optimize animations’ the groups all export as they should, but the file size is way too big.

Does anyone know why this might be? I have the same models carrying over in to the different animation groups but they only animate in some of them.

The file seems to export fine from Maya but I have a few settings that won’t translate over properly so need to export this from Max idealy

Thanks!

Hey @jhp Welcome to the Babylon Family! So great to have you here.

Pinging @Drigax, the exporter guru. He can probably lend some expertise to this!

I’m not entirely sure what’s causing your issue.

Currently, I have a 3dsMax test scene where I have a few objects in a scene, with different shapes, all assigned to different animation groups, where all groups and objects are exported with animation. Can you please share your scene? I’m probably missing your use case in my testing, I assume that our key frame culling during our optimization pass is causing this.

SeparateAnimationsOnInstances.zip (45.3 KB)

Also, which version of the exporter are you using?

Hi @Drigax, thanks for getting back to me. I am using the latest version of the exporter that was released a couple of days ago.

Here are the 2 exported versions of the file in gltf format. You will see 01 exports fine but this is the entire animation, whereas when I split things in to animation groups not everything gets exported in each group. It could be the key frame culling like you mentioned as when I tell the export not to optimize the animation everything is exported fine but the file size is far too big.

I can send you the Max file directly if that helps?

Can you please provide the scene?

Its difficult to work backwards from the export result to pinpoint the issue. If you can’t share your scene publicly, then feel free to send it to whoisdrigax@gmail.com.

I’ve emailed you the file directly…

1 Like

Thanks so much for sharing.

It looks like we’re culling the animations used to keep some of the static elements visible in the scene.

For example, in the first animation group, the elements are scaled up from 0.001 to appear into the scene, then remain at scale 1 for a number of animation groups until they are hidden again in later groups.

I believe that our optimization pass is improperly excluding these animation tracks, and even neglects the “Export Non-Animated Objects” toggle that I would assume should prevent this culling.

EDIT Export Non-AnimateObjects is intended for including objects that don’t have any animation track to have a static animation generated for their inclusion in the animation group.

Therefore our objects in the gltf export remain at scale 0.001 in the animation groups (their “default” scale since that is their initial scale at frame 0) that they are not animated in. I’ll see if I can simplify the repro as I look into this closer.

Thanks again :slight_smile:

Looking closer, its not that the animations are culled, so much that there are no scale keyframes in the range of some animation groups for the missing objects.

Talking over possible fixes with @PatrickRyan, I think the best way to fix this is to bake out the start and end frame of each animation track for each object included in the animation group to ensure that the scene intent is preserved.

As a workaround for now, manually keyframing the start and end frames of your animation groups for the animated objects in the scene should ensure that they are exported as expected.

I created

to track progress on this implementation, but this isn’t a trivial change to make, I first want to prioritize resolving Lightmap on UV2 is not correctly exported · Issue #594 · BabylonJS/Exporters · GitHub before focusing on this.

I’ve managed to get this working on some of the animation groups by setting keyframes for the scale and position of the various models however its not working for all of them. The first 10 groups are all fine but after that it’s not working.

If I export my file as an FBX is there an easier way to set animation groups using another software that won’t encounter this issue? Is there no way I can just export the whole animation as a single group (as that plays out fine) and my devloper triggers a set range of key frames, or must animation groups be set up for this to work?

Thanks

Adding @PatrickRyan out in house artist in case he got some tricks.

(please just be a bit patient as patrick is out of office until next wednesday)

Thanks a lot for all of your help guys. I’ve just about managed to get this file working but there was a lot of hacking and trial and error to get it to work correctly. It would be great to have a better solution so I can tidy this file up and use that pipeline going forward. If I need to make any changes to this project its not going to be fun!

Cheers

1 Like