PyMeshLab icon indicating copy to clipboard operation
PyMeshLab copied to clipboard

Not generate proper normal after normal estimation

Open xtorker opened this issue 4 years ago • 1 comments

python 3.7.6 pymeshlab 0.1.8

filter: compute_normals_for_point_sets

reproduce code:

    ms = ml.MeshSet()
    ms.load_new_mesh('longdress_vox10_1051.ply')
    ms.apply_filter('compute_normals_for_point_sets', k=30)
    ms.save_current_mesh('longdress_vox10_1051_normal.ply')

Attached is the model I used. longdress_vox10_1051.zip

The process is done perfectly in MeshLab (GUI). I have also tried to save the filter script and load it into python code, but still failed.

xtorker avatar Jan 28 '21 07:01 xtorker

Thanks for reporting! I checked, and this is not a bug of pymeshlab, but a "known problem" of the compute_normals_for_point_sets filter.

In fact, the process can be done perfectly also using pymeshlab, but with k=10. The same result can be obtained using MeshLab 2020.12d (which is the one used by pymeshlab). I checked in the code and there are no unwanted double-to-float casts.

The issue is related to the filter because it is very difficult to predict the exact value of k that will work well: for some values normals are well oriented, for others they are inverted. And it seems that also the floating point precision (2020.12 or 2020.12d) used for the computation influences the k value.

Therefore a proper post-processing for this specific filter should be added in order to output well oriented normals regardless k. I'll try to do this ASAP!

alemuntoni avatar Jan 28 '21 16:01 alemuntoni