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
192 stars 28 forks source link

Problem of generating obj file with texture mapping #8

Closed code-conquer closed 2 years ago

code-conquer commented 2 years ago

First of all, thank you very much for sharing such excellent work. I want to put the last generated texture into meshlab for analysis, so I generated an obj file, which contains 3D face vertices and corresponding faces, but there was a problem when adding 2D texture vertices and faces. The complete 2D faces index is not found. Can you tell me how to get the complete 2D texture vertices and faces? Thank you again! Looking forward to your reply!

barisgecer commented 2 years ago

Can you give me more insight about at which part you had this problem? Or maybe share the generated assets?

code-conquer commented 2 years ago
    self.tcoords_full = mio.import_pickle('models/topology/tcoords_full.pkl')
    self.tcoords = mio.import_pickle('models/topology/tcoords.pkl')    
    self.mask = mio.import_pickle('models/topology/mask_full2crop.pkl')
    self.tight_mask = mio.import_pickle('models/topology/mask_full2tightcrop.pkl')
    self.template = mio.import_pickle('models/topology/all_all_all_crop_mean.pkl')
    self.lms_ind = mio.import_pickle('models/topology/all_all_all_lands_ids.pkl')

Thank you for your reply. I found that when I use 3D vertices in tcoords_full.pkl to generate obj files, the texture and geometry are not aligned. When I use tcoords.pkl and mask_full2crop.pkl to generate obj, the texture and geometry are aligned, but the texture of the ears are not included. Can you explain the role of these files? Or how to generate obj files containing ears? in short, this code can be used to generate obj aligned with texture and geometry:
self.full_uv_vertices = self.tcoords_full.copy().points self.full_uv_vertices[self.mask] = self.tcoords.points Using the following code alone generates misaligned:

self.full_uv_vertices = self.tcoords_full.copy().points

barisgecer commented 2 years ago

You are right. The Full topology is different than the topology of the UV texture images OSTeC is generating. The reason why I preferred to exclude ears is that they are often occluded in StyleGAN space and are difficult to match correctly. Thus you need to use cropped topology to visualize properly.

code-conquer commented 2 years ago

Okay, I get it. Thank you very much for your patient reply!

zeta7337 commented 2 years ago

Okay, I get it. Thank you very much for your patient reply!

hello,i face the same problem.how do you fix it?