Maya Export, Rotation animation wrong

Hi everybody!

I fell over an issue with the maya to babylon exporter. It seems like the export of rotation animation values doesn’t work properly if you don’t check the bake animation frames option in the exporter. I tried to create a camera move with 3 keys (on all translation and rotation attributes) and the rotations were always off quite a bit (even on the end pose, start pose seems to work though). So I tried baking it in maya and the results were even worse.
Baking it with the babylon exporter seems to do the trick. Unfortunately for several reasons I can’t do this for my project (or only with severe implications for the pipeline).
Since I am a new user I can’t upload the babylon files, however my colleague Oglu will post them here soon

I uploaded the files now.

@Deltakosh (2.4 MB)

Hello there is no guarantee Babylon.js will be able to strictly reproduce the way Maya animations behave
Maya has so many options for animations

Let me ping @PatrickRyan who may help pinpointing which animation option is not supported.

The best option is to only use linear animations if you can (or just bake them)

By the way, can you tell me why baking is not an option?

I’m on the way to the office now. I’ll check this file when I get in.

Hi Deltakosh, thanks for replying!
I understand that interpolating between keyframes is handled differently between applications, but the issue is, the real orientation are completely different between maya and babylon on the keys themself resulting in the camera looking in the wrong direction in babylon.

I tried using linear animations (didn’t change the behaviour) and baking them in maya before exporting (resulting in random camera orientation each frame in babylon)

I assume that by checking the bake animation frames options of the maya exporter, the rotation values are recalculated in a way that fits babylon better, but I can’t pinpoint the problem further than this unfortunately

To the reason why I can’t use that Bake Animation Frames option:
I do some camera animation and environment animation in the same scene. Some of them are very simple (linear interpolation would be fine) and loop over a very long time range so baking would be a huge waste of space and memory. For this camera animation I would be fine with baking it, but then everything else in this scene would be baked as well, so I’d have to seperate the scene into different animated objects which would be a nightmare to organize

Gotcha. This should work so I let Patrick do his magic here :smiley:

@shade0625 and @oglu, is there a way for me to get your original Maya test file? I looked at the Babylon files you supplied and I have a few thoughts, but want to verify what’s in the Maya file first. Thanks for your help!

Hi Patrick, wow you guys are fast!
Unfortunately i’m not in the Office anymore, but I’ll send it tomorrow morning. Thx for the help!

1 Like

Here it is (642.6 KB)

@shade0625, We looked into the file and bounced around ideas with practically the whole team. We understand what’s going on and @Drigax will be working on a fix for non-baked export into .babylon files. We’ll update the thread asap with a fix on the exporter. Thanks for sharing all of the assets as it made debugging the issue much easier!

1 Like

This is a textbook example of what happens when you forget to check your units before computation. :wink:
The maya animation data was represented in Euler angle degrees, our conversion function expected radians:

Fix should be in ASAP.

1 Like

Great, glad I could help with the files! Looking forward to the fix and thx for the fast response!

Patrick (shade0625) i updated the fixed exporter version on the server.

1 Like

Almost there, it worked at first, but I tweaked the animation a tiny bit, and now the camera is tilted on it’s starting position. I think this is a rotation order thing, because if I change the rotation order in maya to “zxy” instead of “xyz” I get a similar result like in the export.
I attached the maya scene file and babylon export in the zip (646.3 KB)

Looks like its still broken.
Could someone take a second look?

Pinging @Drigax

@shade0625, @oglu

I’m not sure if I understand the camera tilt issue.

I’ve tested your provided scene with zxy, xyz, and yxz rotation order on the “camera1” object in scene, with no difference in camera starting orientation or animation in the exported babylon scene. Can you please provide some more detail in how to reproduce this issue?

Looking at the Maya scene, I can also see that the camera has X and Z rotation at frame 0 (extrapolated from the key at frame 64):

This may be related to the initial tilt as well.

Thx for looking into it again! Are you sure you tested with the last scene I sent? It should be called location_032_exportBug.mb?
This is how it should look like:

when I export and run it, it looks like this:

And the reason why I think it’s an rotaton order thing during the export is, if I change the rotation order in maya, it looks like the export (which I don’t want):

By the way, the camera has rotations in x and z, because it’s absolutely gimbal locked, which isn’t a nice testcase - I know :slight_smile: - but I guess the values should still translate correctly.
Thanks again for looking into it!


Ah I see! I didn’t have a texture applied on the room, so I wasn’t able to see the difference between how the orientation is computed between different orders. Thanks for the explanation!

I assume this is related to how we convert to quaternion. Currently we do not take rotation order into account in the conversion process (as Babylon.js only supports YXZ rotation order), but this is a good use case to highlight that limitation. I’ll see if I can modify it today to export properly.

Hi Drigax, thx, using the set rotation order would be a huge help since the maya standard is xyz. But I guess if Babylon only supports YXZ there’s no other way than baking the rotations? I mean as long as we know it, we could reset the standard order in maya to YXZ (I would recommend adding this to the maya exporter documentation then) , but in the long run it would be great if this could be a flexible setting.