网格导出无法构建可读的层文件

Export of mesh fails to build a readable ply-file

我写了一个小脚本,它的任务是加载网格(层),然后应用一些过滤器,最后将整个东西导出为层。

到目前为止一切顺利。但是生成的层文件无法读取。如果我尝试在 MeshLab 中打开它,它会显示:“Face with more than 3 vertices”

这里是与pymeshlab相关的代码部分(已清理):

import pymeshlab as ml
ms = ml.MeshSet()
ms.load_new_mesh(path + mesh_name)
ms.apply_filter('convert_pervertex_uv_into_perwedge_uv')
ms.apply_filter('transfer_color_texture_to_vertex')
ms.save_current_mesh(path + 'AutomatedGeneration3.ply')

我错过了什么吗?执行这个脚本其实并没有报错信息。我也尝试使用一些参数来保存过滤器,但它没有改变任何东西。

我该如何做对?

这似乎是方法 ms.save_current_mesh() 内部使用的 .ply 导出器中的错误。

该方法试图保存存储在网格中的所有信息,此时是 texture_per_vertex、texture_per_wedge 和 color_per_vertex,那里出了点问题。

我已经通过禁用保存 texture_per_wedge(这对于 transfer_color_texture_to_vertex 过滤器是必要的。

import pymeshlab as ml
ms = ml.MeshSet()
#Load a mesh with texture per wedge
ms.load_new_mesh('input_pervertex_uv.ply')
m = ms.current_mesh()

print("Input mesh has", m.vertex_number(), 'vertex and', m.face_number(), 'faces' )

ms.apply_filter('convert_pervertex_uv_into_perwedge_uv')
ms.apply_filter('transfer_color_texture_to_vertex')

#Export mesh with color_per_vertex but without texture
ms.save_current_mesh('output.ply',save_wedge_texcoord=False,save_vertex_coord=False )

可在此处阅读 save_current_mesh 的有效参数列表 https://pymeshlab.readthedocs.io/en/latest/filter_list.html#save-parameters

请注意save_vertex_coord指的是每个顶点的纹理坐标!!!