mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
100.26k stars 35.19k forks source link

FBX Loader: Blender export with rotation animation will result in error #27907

Open nookinook opened 3 months ago

nookinook commented 3 months ago

Description

FBX loader does not load models exported from blender when the animation contains a rotation. Only translation works fine. Also export from other DCC (3ds Max) works. Tested with Blender 3.6 and 3ds Max 2020 and r160

Orginial thread: https://discourse.threejs.org/t/blender-fbx-imported-in-threejs-error/62357

@Mugen87 tracked the issue: "it seems this is a regression in FBXLoader which was introduced in r159 by this PR: https://github.com/mrdoob/three.js/pull/27057 "

Reproduction steps

  1. Create a model with simple rotation animation in blender and export to fbx with animation and default settings (or download this example: https://discourse.threejs.org/uploads/short-url/1zwNloZNfCRb2L3vnYk7vt1xYnQ.fbx )
  2. Drag`n drop it into threejs editor
  3. Error appears

Code

three.module.js:42485 Uncaught (in promise) Error: THREE.KeyframeTrack: no keyframes in track named Cube.quaternion
    at new KeyframeTrack (three.module.js:42485:58)
    at new QuaternionKeyframeTrack (three.module.js:42993:1)
    at AnimationParser.generateRotationTrack (FBXLoader.js:2848:37)
    at AnimationParser.generateTracks (FBXLoader.js:2777:31)
    at FBXLoader.js:2748:34
    at Array.forEach (<anonymous>)
    at AnimationParser.addClip (FBXLoader.js:2746:17)
    at AnimationParser.parse (FBXLoader.js:2456:23)
    at FBXTreeParser.parseScene (FBXLoader.js:926:44)
    at FBXTreeParser.parse (FBXLoader.js:171:8)

Live example

https://threejs.org/editor/

simply dragn drop the fbx file to see the error

Screenshots

No response

Version

160

Device

No response

Browser

No response

OS

No response

Mugen87 commented 3 months ago

/ping @solinehayes

It seems r159 breaks the FBX asset of the OP and I believe the root cause is #27057. Do you mind having a look?

pikilipita commented 1 month ago

If a project is affected by this issue, can I use the latest threejs version but stick to the fbx loader from r158, or should I stay on threejs r158 until this is solved?

Mugen87 commented 1 month ago

We do not recommend to use modules from different releases. Even if it seems to work, there might be unexpected side effects.