text2mesh icon indicating copy to clipboard operation
text2mesh copied to clipboard

How to obtain textures?

Open MattiaCasalegno-PRATT opened this issue 2 years ago • 8 comments

Hello, thank you for sharing this incredible project. I am testing text2mesh and do not see any textures as output beside some PT files. How shall I go in order to add textures to the final .obj? We are using Blender or any similar 3d software. Thank you so much for your help! Mattia

MattiaCasalegno-PRATT avatar Mar 27 '22 05:03 MattiaCasalegno-PRATT

Hi Mattia. Our method does not generate a uv texture map, which would require parametrization (unnecessary for our method). Instead we simply predict a color at each vertex position. These colors are saved in the .obj files output by the code. These vertex colors will be sufficient for many tasks that would involve a texture map, but not possible for tasks that require a parametrization i.e. texture transfer.

ojmichel avatar Mar 27 '22 23:03 ojmichel

If you want to view these colors in blender, you can bake them. You would probably need to use auto UV unwrap and convert the obj to ply. This tutorial might be helpful: https://youtu.be/7cphcAZ5ai8

ojmichel avatar Mar 28 '22 00:03 ojmichel

Thank you ojmichel, I opened the obj in Meshlab and managed to export textures from there! What would be the best way to increase the resolution of the output model? I am remeshing the original source meshes and increasing the number of vertices but still getting some errors when running the model. Is there any specific setting in Meshlab we have to be aware when exporting? And is there somewhere a description of the various commands? Sigma, Geoloss, clamp tanh, normincrop, max crop, etc etc ?

MattiaCasalegno-PRATT avatar Mar 29 '22 04:03 MattiaCasalegno-PRATT

@MattiaCasalegno-PRATT can you explain how you exported the textures from Meshlab? I've tried to convert the vertex color to UV texture, but it never works. I don't have much experience with meshlab, so i could be doing something wrong

chrober24 avatar Apr 01 '22 18:04 chrober24

@MattiaCasalegno-PRATT can you explain how you exported the textures from Meshlab? I've tried to convert the vertex color to UV texture, but it never works. I don't have much experience with meshlab, so i could be doing something wrong

if the question is still actual, here is the way how you can export obj with textures from Meshlab:

  1. Import mesh into Meshlab
  2. Filters/Texture/Parameterization: Trivial per-triangle
  3. Filters/Texture/Transfer: Vertex Attributes to Texture (1 or 2 meshes). Check Assign Texture and Fill Texture checkboxes
  4. Export Mesh

artem-konevskikh avatar Aug 28 '22 05:08 artem-konevskikh

I found a way to do this programmatically with pymeshlab (pip install pymeshlab)

import pymeshlab
ms = pymeshlab.MeshSet()

ms.load_new_mesh('person_final.obj')
ms.compute_texcoord_parametrization_triangle_trivial_per_wedge()
ms.transfer_attributes_to_texture_per_vertex(pullpush=True)
ms.save_current_mesh('person_final.obj', save_textures=True)

It saves the mesh into 3 files : .obj, .png and .mtl

Achuttarsing avatar Aug 31 '22 21:08 Achuttarsing

Hi, is there an easy way to increase the resolution of the object file. Also, I noticed that the final .obj file also has a different size ratio.

Debangsha1992 avatar Jan 03 '23 08:01 Debangsha1992

I found a way to do this programmatically with pymeshlab (pip install pymeshlab)

import pymeshlab
ms = pymeshlab.MeshSet()

ms.load_new_mesh('person_final.obj')
ms.compute_texcoord_parametrization_triangle_trivial_per_wedge()
ms.transfer_attributes_to_texture_per_vertex(pullpush=True)
ms.save_current_mesh('person_final.obj', save_textures=True)

It saves the mesh into 3 files : .obj, .png and .mtl

If I understand correct, the python script that contains the code snipets should be put in the same folder with the produced .obj file, right?

EadmondDai avatar Nov 01 '23 22:11 EadmondDai