pyassimp如何将3d模型导出到gltf2.0

pyassimp how to export 3d model to gltf2.0

使用 pyassimp 将 obj 模型转换为 gltf2.0,

pyassimp.export(scene,'444.gltf','gltf')

但导出 gltf 版本是 1.0

"asset": {
    "version": "1",
    "generator": "Open Asset Import Library (assimp v4.0.0)"
},

如何将gltf导出到2.0版本?谢谢

引用 pyassimp 导出函数的文档字符串:

>>> help(pyassimp.export)
Help on function export in module pyassimp.core:

export(scene, filename, file_type=None, processing=8)
    Export a scene. On failure throws AssimpError.

    Arguments
    ---------
    scene: scene to export.
    filename: Filename that the scene should be exported to.  
    file_type: string of file exporter to use. For example "collada".
    processing: assimp postprocessing parameters. Verbose keywords are imported
                from postprocessing, and the parameters can be combined bitwise to
                generate the final processing value. Note that the default value will
                triangulate quad faces. Example of generating other possible values:
                processing = (pyassimp.postprocess.aiProcess_Triangulate | 
                              pyassimp.postprocess.aiProcess_OptimizeMeshes)

在您的情况下,这意味着您应该使用 file_type gltf2 调用该函数,如下所示:

pyassimp.export(scene,'444.gltf','gltf2')