Blender animation involving rotation values > 360° incorrectly exported to GLTF?

I have a mesh rotating in Blender from 376° to 132°, when exported to .glb, the rotation looks like it goes from 16° to 132°, missing extra 360°.

Is it possible to fix?

Animation rotation after importing to THREE has quaternion points, so it’s hard to tell.

test.blend (739.3 KB)

test.glb (5.3 KB)

Is this related:

Blender Rotation Modes

In a nutshell, it says there are three rotation modes:

  • Euler Modes
  • Axis Angle Mode
  • Quaternion Mode

For the quaternion mode its says:

The only drawback is that you cannot interpolate between two orientations that are at a distance greater than than 180°, as the animation will take the shortest path between them. Thus to animate a revolving element you must set up many intermediate keyframes, 180° from each other at most.

Blender rotates everything correctly, I’m using axis rotation.

GLTF export is incorrect, from what you said, I guess the exporter converts all modes to quaternions and doesn’t add intermediate points.

Is it a Blender issue or GLTF exporter?

Maybe there is an exporter setting to fix this, or export angle-based rotation?

Does it work when you add intermediate rotations? Maybe Blender has some option to split a long animation into steps by adding intermediate “keyframes”?

Edit: if you import the GLB back into Blender and its rotation is broken, then it is an issue with the Blender GLTF exporter. If it works fine, it might be an issue with the Three.js GLTF loader.

Add a keyframe!
Since time began, or at least since 3d platforms began, this has been an issue.
The quick and dirty solution being to add a keyframe in the middle, so the interpolation engine knows which way to go. And mathematically 376 degrees IS 16 degrees??

I have a few dozen rotating objects in Blender, manually adding extra keyframes and calculating in each case where to put them, so the angle diff is less than 180 for each piece is a lot of work.

Another problem is that if I say divide one transition in half with an extra keyframe, in GLTF the second half starts to rotate in the wrong direction (ccw instead of cw). I don’t know how to fix that except to reverse rotation of this half in Blender but then it turns everything into a mess.

So I’m asking if there is a way to export Blender animation into GLTF correctly and automatically, which an exporter is supposed to do (or so I thought).

The Blender exporter should export animations correctly and automatically. If it doesn’t do so, I would file a bug with the .blend file at GitHub - KhronosGroup/glTF-Blender-IO: Blender glTF 2.0 importer and exporter.

1 Like

Hey there!
Reverting with an actual solution to this issue that I have struggled with myself.

So here’s what I’m doing:

  1. Author a >360 degree rotation animation (just for this example’s sake)
  2. Insert the corresponding keyframes into the animation timeline (I on the keyboard while mouse is hovered over the rotation transform panel in Blender)
  3. Go to the animation Dope Sheet and expand everything under your animation
  4. Under Object Transforms, remove all the axis that you are not animating (in our case, only keep the Z Euler Rotation)
  5. Export your GLTF.

Before:
Screenshot 2023-12-05 at 17.21.39
After:
Screenshot 2023-12-05 at 17.22.21

This worked for me with Blender 3.6+
Hope it helps!

-AF