Three.js: FBXLoader does not handle rotation order different from 'ZYX'

Created on 14 Oct 2017  路  9Comments  路  Source: mrdoob/three.js

Description of the problem

As per FBX documentation, rotation animations can be specified with different Euler formats (axes order). This is currently not parsed from the loader resulting in wrong animations.

Three.js version
  • [x] Dev
  • [x] r87
  • [ ] ...
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [x] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)
Loaders

Most helpful comment

I'll look into it over the next couple of days.

@ignazioa if you could share some model (preferably very simple ones) with different rotation order that I can use for testing that would speed things up.

All 9 comments

/ping @looeee

I'll look into it over the next couple of days.

@ignazioa if you could share some model (preferably very simple ones) with different rotation order that I can use for testing that would speed things up.

@looeee Don't have a simple one but the following has RotationOrder property defined in several nodes:
test_rotation_order.zip

Thank you, I'll find some time to look into this over the next couple of days.

Here are some test files in case anybody else comes across this

fbx_rotation_order_test.zip

@looeee Any idea on what to do with RotationOrder = eSPHERIC_XYZ = 6 ?

Yes - show a warning saying that it's not supported 馃槈

@looeee FYI, after some tests I had to move 'PreRotation' order parsing to where reference to the model was available (and its RotationOrder). See below, hope it helps
`

var orderEnum = ['XYZ', 'XZY', 'YZX', 'YXZ', 'ZXY', 'ZYX', 'XYZ'];
for ( var containerIndicesIndex = containerIndices.length - 1; containerIndicesIndex >= 0; -- containerIndicesIndex ) {
    var boneID = findIndex( sceneGraph.skeleton.bones, function ( bone ) {
        return bone.FBX_ID === containerIndices[ containerIndicesIndex ].ID;
    } );
    if ( boneID > - 1 ) {
        returnObject.containerBoneID = boneID;
        returnObject.containerID = containerIndices[ containerIndicesIndex ].ID;
        var model = rawModels[ returnObject.containerID.toString() ];
        if ( 'PreRotation' in model.properties ) {
            order = 'XYZ';
            if('RotationOrder' in model.properties)
            {
                order = orderEnum[model.properties.RotationOrder.value];
            }
            order = reverse(order);
            var preRotations = parseVector3( model.properties.PreRotation ).multiplyScalar( Math.PI / 180 );
            returnObject.preRotations = new THREE.Euler().setFromVector3( preRotations, order );

        }
        break;
    }
}

`

After #12411 and #14933 rotation order should be fully supported in the loader, so this can be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

makc picture makc  路  3Comments

yqrashawn picture yqrashawn  路  3Comments

boyravikumar picture boyravikumar  路  3Comments

akshaysrin picture akshaysrin  路  3Comments

ghost picture ghost  路  3Comments