smoothingmeshlablaplacianspike

Meshlab Laplacian Smooth introduces spikes


I am using MeshLab to smooth a mesh obtained from a 3d numpy array through marching_cubes and pymesh. I am processing a few similar meshes and only one of them is giving me this problem. The filter used is Laplacian Smooth with parameters:

Attached are the images of the mesh before and after the Laplacian smoothing. Unfortunately the images have to be cropped in the interested areas due to privacy concerns.
Any help in tracking down the issue or any debugging suggestions would be really helpful.
Thank you!

mesh before laplacian smooth in first region

first spike

mesh before laplacian smooth in second region

second spike


Solution

  • Can you provide a mesh sample? it could be a numerical issue due to degenerate zero area triangles that can happen as a result of MarchingCubes. The reason is that Laplacian smoothing tries to move vertices along the tangent planes of the surface that results undefined for zero area triangles. Eventually you could also try to remove those degenerate triangles by running a merge close vertices filter. This issues can came up also because desktop meshlab runs on float while its python counterpart pymeshlab runs on double. Eventually just try the mesh from numpy arrays directly using pymeshlab

    import numpy as np
    import pymeshlab as ml
    import k3d
    
    ms = ml.MeshSet()
    ms.set_verbosity(True)
    ms.apply_filter('implicit_surface',voxelsize=0.050000000001,expr="x*x+y*y+z*z-0.5")
    #ms.apply_filter("merge_close_vertices")
    ms.apply_filter("laplacian_smooth",stepsmoothnum=1)
    ms.apply_filter("compact_vertices")
    ms.apply_filter("compact_faces")
    
    plot = k3d.plot()
    plot += k3d.mesh(ms.current_mesh().vertex_matrix().astype(np.float32), 
                     ms.current_mesh().face_matrix().astype(np.uint32),color=0xf0f0c0)
    plot.display()