barisgecer / OSTeC

TF implementation of our CVPR 2021 paper: OSTeC: One-Shot Texture Completion
https://openaccess.thecvf.com/content/CVPR2021/html/Gecer_OSTeC_One-Shot_Texture_Completion_CVPR_2021_paper.html
Other
189 stars 28 forks source link

how to generate obj file? #14

Closed tianyu06030020 closed 2 years ago

tianyu06030020 commented 2 years ago

I want to observe the reconstructed performance in meshlab or blender, please give me a tip how to generate the obj file, thank a lot.

AyushP123 commented 2 years ago

Hi, Can you share how did you save the texture and obj file? I am able to just save the mesh and the texture separately but am not able to save a textured mesh.

tianyu06030020 commented 2 years ago

Hi AyushP123, I'm not sure whether you met the same problem as me, I want to observe the 3d reconstruction so this is my solution as follows:

1、generate the obj file with vt coordinate. (be attention: the minimum of the face index in obj file must 1) 2、generate the uv map. 3、observe the performance through mtl file

laolongboy commented 2 years ago

Hi, can you share your code exporting the obj file. I have tried using menpo3d.io.output.base.export_textured_mesh. But the results are not correct.

tianyu06030020 commented 2 years ago

Hi, can you share your code exporting the obj file. I have tried using menpo3d.io.output.base.export_textured_mesh. But the results are not correct.

Hi, laolongboy

the only difference with #12 is that I add the tmesh.trilist by 1:

import menpo3d.io as m3dio results_dict['face'].tmesh.trilist += 1 m3dio.export_textured_mesh(results_dict['face'].tmesh, save_path.replace(ext, ".obj"), extension="obj", overwrite=True)

laolongboy commented 2 years ago

Hi, can you share your code exporting the obj file. I have tried using menpo3d.io.output.base.export_textured_mesh. But the results are not correct.

Hi, laolongboy

the only difference with #12 is that I add the tmesh.trilist by 1:

import menpo3d.io as m3dio results_dict['face'].tmesh.trilist += 1 m3dio.export_textured_mesh(results_dict['face'].tmesh, save_path.replace(ext, ".obj"), extension="obj", overwrite=True)

Thanks. It works.

image

The saved .obj file includes the texture coordinates. How can I display the texture in MeshLab?

tianyu06030020 commented 2 years ago

the origin output has uv_map, you can write a mtl file which can connect with obj and uv_map, mtl point out the uv_map and obj point out the mtl file, then you will see the mesh with texture

manifoldhiker commented 2 years ago

Could somebody explain why tmesh.trilist += 1 works? Thank you in advance 🚀

barisgecer commented 2 years ago

In the latest commit, I wrote an export script at the end of run_ostec.py. So just running it should give you obj files with tcoords and texture maps, thus can be viewed directly on MeshLab etc.

zenonLEE commented 2 years ago

the origin output has uv_map, you can write a mtl file which can connect with obj and uv_map, mtl point out the uv_map and obj point out the mtl file, then you will see the mesh with texture

Hi, can you share your code exporting the mtl file with uv map and obj file. Thank you in advance!