cnr-isti-vclab / meshlab

The open source mesh processing system
http://www.meshlab.net
GNU General Public License v3.0
4.8k stars 827 forks source link

[Linux] FBX importer does not honor mesh topology #1118

Open Poupine opened 3 years ago

Poupine commented 3 years ago

Hi there,

I'm using meshlab version 2021.07 for Linux and I noticed that the FBX importer seems to always spit out a triangle mesh. I saved the same quad-mesh as obj and fbx (ascii, too make sure the indices indeed form a quad) from a library I wrote myself using Assimp. When opening the obj file in meshlab I get a quad-mesh as expected, but in the fbx case I always get a triangle mesh. I think this is a bug and the right thing to do would be to always honor the topology as written in the original asset file, regardless of its format. Unfortunately, I cannot share the meshes that I've been working with but any quad-mesh imported in meshlab should show the issue I'm describing.

alemuntoni commented 3 years ago

I agree. However right now only a some subset of file formats are supported with polygonal meshes by meshlab. I can't say when the FBX importer (and other importers too) will support also polygonal meshes.

Poupine commented 3 years ago

I see. I don't know how the FBX importer is implemented exactly in meshlab but it sounds to me like it's always calling triangulate. Whether that's done from assimp/the FBX SDK or in meshlab data structure after import I don't know. But since loading a quad-mesh from OBJ gives a quad-mesh, I'd argue that meshlab's internal structure supports it and hence it should only be a matter of checking at the import what the number of index per face is and creating the appropriate structure for meshlab accordingly rather than breaking everything that comes in into triangles

Poupine commented 3 years ago

I just realized that the FBX importer also doesn't honor vertex ordering (it does for OBJ though/I have not tried other formats). I was about to create another issue but I think this info belongs here as well. I don't know what is used to handle FBX import/export in meshlab. Is it assimp? Or something else? Personally, in order to keep topology/vertex order, I've had to write my own importer using the FBX SDK.

alemuntoni commented 3 years ago

The FBX importer is implemented in the [IOBase]() plugin, which uses the version of OpenFBX contained in the VCGLib.