Search code examples
meshlab

How "export mesh as" with updated texture file from MeshLab?


A couple years ago, a question was asked and answered about exporting a cleaned mesh from MeshLab. The answer included re-using the original texture image file (generated by Meshroom).

How to correctly export a mesh as a .obj using "export mesh as" ?- unable to get a file with the textures

After my mesh cleaning, much of my original texture image file is no longer needed. Can I export an updated and much smaller texture image file from within MeshLab?

I looked through the options in MeshLab and I searched for solutions online. I was unable to find how to export an updated version of the texture image file from within MeshLab.

Thank you, TS


Solution

  • Unfortunatelly, meshlab won't do that work for you. It has a very limited operations on texture and for sure it don't include optimization/modification of texture coordinates.

    I have seen many projects addressing this problem, like this nice Pythagoras Bust model originally published by Geoffrey Marchal.

    enter image description here

    which uses this 4096x4096 texture:

    enter image description here

    where clearly only the bottom third of the image pixels are being used as texture, so it could be stored in just a 4096x1666 image without any loss. This is not a specific problem of this model, but a quite common problem generated by some photogrammetry software.

    I have written some small scripts with pymeshlab that can do some work done (basically, compute the bounding box of the texture coordinates, crop the original texture to that bounding box, and then remap the old texture coordinates into the new texture).