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

Three.js FBX Binary format not supported

本文关键字:二进制 格式 FBX js Three 不支持      更新时间:2023-09-26

我正在一个基于javascript的移动应用程序中使用three.js。我正在使用三维模型的.fbx文件。但它不支持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 );

如果您查看javascript文件或https://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转换器到glTF,并使用glTF加载程序。

请注意,二进制FBX文件还有另一个问题,有时可能会导致问题。在2016.0中,对支持大文件(>2Gb)进行了更改。此更改仅影响二进制FBX文件格式。由于文件指针的大小不同,旧的读取器无法读取这些指针。但对于其他文件,这些文件几乎是兼容的。当然,这不会影响这里的javascript加载程序,因为我是为使用FBX SDK的人提到这一点的,但值得一提。