0

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

1 Answers1

0

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).

Rockcat
  • 3,002
  • 2
  • 14
  • 28
  • Thank you Rockcat. Would you be willing to share your pymeshlab scripts for this operation? Regardless, your response is much appreciated. TS – Tree Sesame May 03 '23 at 16:51
  • Give me a couple of days to search and do some clean ups in the code – Rockcat May 03 '23 at 20:54
  • Thanks for your efforts! I'm pretty new to Python and very new to models, but I will enjoy learning and being able to achieve this pruning! TS – Tree Sesame May 04 '23 at 14:27
  • Rockcat, if you're still willing to consider sharing your code, I'm still quite interested. I need to reduce the size of my texture files from 16k pixels square to 2k pixels square so I can properly view them in VR using Gravity Sketch on Quest2. Most of my textures are unused from the room in which I did human photogrammetry with my home made camera array. Thanks for considering, TS – Tree Sesame Jun 29 '23 at 18:07
  • My mistake. I looked for the code and found that was not written for meshlab, but to my old 3D library. Then I translated to pymeshlab and found a bug in the library. Then I filed an issue to the developers. The bug was solved, but then I have to wait for the next release to be published. Then forgot everything... Give me a couple of days to restart the idea. – Rockcat Jun 29 '23 at 22:29
  • I have just confirmed. The bug was solved in May, but we must wait until a new version of pymeshlab is released. – Rockcat Jun 30 '23 at 06:24
  • I have publish the code at https://github.com/cnr-isti-vclab/PyMeshLab/discussions/313 – Rockcat Jul 03 '23 at 11:52
  • @TreeSesame, I have publish the code at github.com/cnr-isti-vclab/PyMeshLab/discussions/313 – Rockcat Jul 03 '23 at 12:40