Support Meshlab filters in Blender
Proposed: a Blender add-on which can call Meshlab filters from Blender and apply them to Blender meshes.
Blender has a small set of mesh cleanup and reduction tools, including "Decimate" and "Limited Dissolve". The more powerful operations for making low-poly models, such as quartic mesh reduction, are not supported.
Meshlab has such tools. It has a broad collection of tools for mesh cleanup and repair. Meshlab is well-respected in its specific area. It does not play well with Blender. It does not read or write .blend files, so meshes must be exported as .dae or .obj files, processed in Meshlab, and returned to Blender. Blender-specific info does not survive this process. Material information, modiifers, nodes, etc. are lost. Thus, you usually can't use Meshlab in the middle of a Blender project.
Details:
Meshlab's real work is done by Meshlab filters, which are DLLs or shared objects written to comply with a documented standard interface. A Blender add-on which implemented the Meshlab interface could call existing Meshlab filters directly. The MeshLab filter interface is C++. It may be possible to do this entirely from Python, using the "ctypes" feature of Python to implement the interface objects needed. A glance at the Meshlab interface code indicates that three major C++ objects, along with other small data structures, would need to be emulated in the add-on.
Doing this looks easier than implementing similar functionality for Blender. It needs an intial look by someone with some "ctypes" experience to size the job.
Meshlab is free software, GPL-licensed like Blender, so there's no licensing problem.
History:
An attempt at this was made in 2012. It worked by exporting files from Blender, invoking the command line version of Meshlab, and reading the results back. That approach suffers from the losses involved in export and reimport. Done from an add-on, you only have to send the mesh to Meshlab; the materials, etc. will still be in Blender when new mesh comes back. Also, as of 2012, Meshlab was not very reliable. Meshlab 2016.12 seems to be better behaved.
4 Comments
I always wondered why the two haven't combined forces, though I wish those features could just be added as modifiers in Blender instead.
@wondraknathan: Different communities. The Meshlab people are funded to do this for data analysis for scientific experiments, not animation. No reason we can't use their stuff.
I don't see how using Meshlab's .dll files will preserve Blender Specific data, though. I have a hunch that a lot of it would have to be re-implemented in order to fully integrate it with Blender's data types. In particular, how would BMesh interact with MeshLab? A look at the source code would tell us, if anyone has a deep knowledge of C++.
I thinks that's why nagle hints at the documented standard interface for the DLLs. The modifiers/filter implemented in blender would of course need to convert any data types into ones complying with the DLL's interface and then back to Blender. Ideal case would be an own implementation with the Blender data types of course, and I guess it's not too difficult since the source from MeshLab is there, but still time consuming.