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

时间:2017-08-30 04:56:02

标签: python assimp

使用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版?感谢

1 个答案:

答案 0 :(得分:0)

引用pyssimp导出函数的docstring:

>>> 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')