valette / Wavemesh

Progressive compression of 3D triangular meshes
https://www.creatis.insa-lyon.fr/~valette/public/project/wavemesh/
GNU General Public License v3.0
42 stars 15 forks source link

Segfault immediately on executing wavemesh executable #3

Closed kanishkaganguly closed 7 years ago

kanishkaganguly commented 7 years ago

I am using VTK 5.10.1+dfsg-2.1build1 on a 64 bit Ubuntu system. However, on running wavemesh with the "c" parameter and a .off file exported from Blender, I get a segfault in in vtkPolyData::GetCellPoints(long long, long long&, long long*&) () from /usr/lib/libvtkFiltering.so.5.10

Is there any particular version of libvtk expected from WaveMesh to run correctly?

valette commented 7 years ago

There is no particular version of VTK. I suspect it is a file format issue. Could you try converting the mesh to an other format such as obj or ply?

kanishkaganguly commented 7 years ago

We have tried multiple formats (OBJ, PLY, OFF, etc) all of which allow the code to run as expected. However, there are segfaults occurring on some meshes and work without failure on others, regardless of the format. Could you provide any hints as to why this may be happening and what to look for in the meshes we use as input? We can provide links to the meshes we are using for your inspection.

Algomorph commented 7 years ago

The segfault occurs on line 356 of vtkWaveletSubdivisionFilter.h:

    vtkSurface * GetSubdivisionInput(){return (this->SubdivisionInput);};

Here is one of the files that wavemesh fails this way on: http://algomorph.com/storage/shotglass1_unholey.obj

Algomorph commented 7 years ago

Further investigation testing on the above mesh reveals that this happens on call to MIO->Write(), line 147 of wavemesh.cxx, and in line 1447 of vtkMultiresolutionIO.cxx:

BaseMesh=this->Filters[this->NumberOfFilters-1]->GetSubdivisionInput();

Now, the NumberOfFilters is 0 at this point for whatever reason, which I guess it's not supposed to be, so obviously the lookup fails. Also, the output of Filters[0] has 0 edges, so it's empty... It seems like something really bad happened, i.e. it was unable to read the file or find the geometry or something.

valette commented 7 years ago

... sorry for the delay...

The mesh properties are:

Mesh with 6994 polygons, 20982 points, 20982 edges
Bounding Box: [-0.033536, 0.966275, -0.05921]
              [0.033592, 1.03345, 0.000733] 
The mesh is made of 6994 triangles
20982 non-manifold edges and 20982 boundary edges

The number of boundary edges is exactly 3 times the number if triangles which means this is a triangle soup, where all the points are duplicated. Unfortunately Wavemesh is unable to process such data. But this could be done if you merge duplicate vertices.

Algomorph commented 7 years ago

@valette , thanks, sorry we've been off the com for awhile as well. Yes, we figured it out that was the problem. Blender's OBJ and PLY exporters all produce meshes in that way. We've merged the vertices using VTK, after which we got much better results. A side note for others: Meshlab's filters can also do the merge.

Again, my apologies for taking up your time to investigate, we should have got back to you. We can now close this issue.