ThreeJS,使用 GLTFExporter 导出后纹理不正确

问题描述 投票:0回答:1

我编写了一个简单的应用程序来合并来自 Mixamo 的多个 FBX(第一个用于模型/材质和动画附加内容),以生成要在 Godot 中使用的 GLB / GLTF,因为我已经足够通过手动完成此操作了搅拌机,但我面临着奇怪的行为。

当我使用 GLTFExporter 导出模型时,纹理完全混乱。

这是导出代码

const exporter = new GLTFExporter();

// Parse the input and generate the gltf output
exporter.parse(
    mainModel,
    // called when the gltf has been generated
    function(gltf) {
        // download the gltf file
        const blob = new Blob([JSON.stringify(gltf)], {type: 'text/plain'});
        const link = document.createElement('a');
        link.download = 'model.gltf';
        link.href = URL.createObjectURL(blob);
        link.click();
    },
    // called when there is an error in the generation
    function ( error ) {
        console.log( 'An error happened' );
        console.log(error);
    },
    {
        binary: false,
        animations: mainModel.animations,
        maxTextureSize: 4096,
        includeCustomExtensions: true
    }
);

这是结果(左边是正确的,右边是导出的)

这是一个已知问题吗?我是不是做错了什么?

感谢您的帮助!

javascript 3d gltf fbx
1个回答
0
投票

您的代码很好,但一种文件格式很少能完美映射到另一种文件格式。它们支持的功能以及表达事物的方式总是存在差异。通过访问有问题的 FBX 文件,有人可能可以对此进行调试,但如果没有它们,就很难猜测。

我的建议是将其中一个 FBX 文件加载到 https://thirdjs.org/editor/,然后尝试导出到 GLB。 Three.js 编辑器使用与您的代码相同的 FBXLoader 和 GLTFExporter 代码。如果它在那里不起作用,最好在 Three.js GitHub 存储库上报告问题。如果它确实有效,那么这个问题可能已经在 Three.js 的更新版本中得到修复。

© www.soinside.com 2019 - 2024. All rights reserved.