【问题标题】:pyassimp how to export 3d model to gltf2.0pyassimp如何将3d模型导出到gltf2.0
【发布时间】:2018-02-07 16:23:33
【问题描述】:

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

【问题讨论】:

    标签: python assimp


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-03
      • 2019-03-07
      • 2015-08-06
      • 2017-10-28
      • 2013-10-16
      • 2019-04-16
      • 2022-01-09
      • 2023-03-27
      相关资源
      最近更新 更多