不支持Three.js FBX二进制格式

时间:2016-05-05 13:18:30

标签: javascript 3d three.js fbx

我在基于javascript的移动应用程序中工作three.js。我正在使用.fbx文件进行3D模型。但它不支持FBXLoader中的二进制格式。我对3D模型和格式了解不多。任何帮助,将不胜感激。

控制台出错: FBXLoader:!!!不支持FBX二进制格式!!!

这是我的加载fbx代码:

    var loader = new THREE.FBXLoader( manager );
    // alert(loader);
    loader.load( 'img/watcher.FBX', function( object ) {
alert(object);
      object.traverse( function( child ) {

        if ( child instanceof THREE.Mesh ) {

          // pass

        }

        if ( child instanceof THREE.SkinnedMesh ) {

           if ( child.geometry.animations !== undefined ||     child.geometry.morphAnimations !== undefined ) {

            child.mixer = new THREE.AnimationMixer( child );
            mixers.push( child.mixer );

            var action = child.mixer.clipAction( child.geometry.animations[    0 ] );
            action.play();

          }

        }

       } );

       scene.add( object );


     }, onProgress, onError );

1 个答案:

答案 0 :(得分:1)

如果您查看header of the javascript filehttps://github.com/yamahigashi/FBXLoaderJS' github repo,就可以看到: ASCII和版本7格式

 /**
  * @author yamahigashi https://github.com/yamahigashi
  *
  * This loader loads FBX file in *ASCII and version 7 format*.
  *
  * Support
  *  - mesh
  *  - skinning
  *  - normal / uv
  *
  *  Not Support
  *  - material
  *  - texture
  *  - morph
 */

另一种方法是使用glTF和FBX converter to glTF,然后使用glTF loader

请注意,二进制FBX文件存在另一个问题,有时可能会导致问题。在2016.0中,进行了更改以支持大文件(> 2Gb)。此更改仅影响二进制FBX文件格式。那些不能用旧读者阅读,因为文件指针的大小不同。但对于其他人来说,这些文件几乎兼容。肯定这不会影响javascript加载器,因为我提到这个使用FBX SDK的人,但值得一提。