导出mesh失败,无法建立一个可读的ply-file



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

到目前为止一切顺利。但是生成的应用程序文件不可读。如果我试着在MeshLab中打开它,它会显示:"超过3个顶点的面">

以下是与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是指每个顶点的纹理坐标!!

最新更新