Closed Qingcsai closed 4 years ago
Hi @Qingcsai, I would need a bit more details to find out what is happening. Could you please try to reproduce your issue with some files from the data folder, post the full code, and explain what is not working?
Thanks!
Hi @jcpassy I have solved this question. I just want to add some texture to .obj
files, so I tried to write the ft, vt, f
by myself.
But now I think I considered this problem over complicated before when I find two functions in Mesh()
, which is .set_texture_image()
and .write_obj()
.
This two functions totally solved my question, and here's the method for helping others who might want to add some texture images to their .obj
files:
import os
from os.path import join
from psbody.mesh import Mesh
path = 'PATH_TO_YOUR_OBJ_FILE'
your_mesh = Mesh(filename = join(path, 'your_mesh.obj'))
your_mesh.set_texture_image(join(path, 'sample_texture.jpg'))
your_mesh.write_obj('PATH_TO_SAVE_IT/your_mesh.obj')
Thanks for your great work! I will close this issue.
Thanks @Qingcsai , glad you got it to work. If you are interested, I think it would be great to add your little example to the documentation. If you issue a PR, I would gladly review it and add your contribution to the next release. Cheers!
@Qingcsai How do you do it. I did but still did not get any texture. and in the mesh repo the .mtl file is constant for all SMPL wont it affect the result What I did in the code of MultiGarmentNet is that I saved the new_garment as an obj and tried to view it but no benifit. Fitting is their but no texture
@PRAKHAR-bit Hi, see https://github.com/Qingcsai/3DVirtualTryOn/issues/1#issuecomment-629921045
Thanks @Qingcsai , glad you got it to work. If you are interested, I think it would be great to add your little example to the documentation. If you issue a PR, I would gladly review it and add your contribution to the next release. Cheers!
Hi, in fact I laterly realized
your_mesh.set_texture_image(join(path, 'sample_texture.jpg'))
your_mesh.write_obj('PATH_TO_SAVE_IT/your_mesh.obj')
only save the constant .mtl
files for all the .obj
, for texture I still need to edit the vt ***
and f ***
stuffs by myself, so I am afraid it's not enough to add texture to .obj files by the above code, which is the reason why I din't issue a PR.
Anyway, thanks again for your great work!
hi @Qingcsai any idea on how to add vt and refined f values into an obj with no vt? also any script that automatically generates obj files with vt values
After I borrowed some code from smpl like below, I found it worked for saving the
class Mesh()
as .obj file.But when I try to add some textures to the faces, I found it wouldn't work after I added some code below, which
m=Mesh(*****)
by definition.I wonder if I have done something wrong? If so, how to save the
class Mesh()
as the.obj
files. Thank you!