daniilidis-group / neural_renderer

A PyTorch port of the Neural 3D Mesh Renderer
Other
1.13k stars 252 forks source link

Save_obj directly after load_obj, blank png (texture) file? #71

Open Goldname100 opened 4 years ago

Goldname100 commented 4 years ago

Here is a snippet of my code, it's fairly simple:

import neural_renderer as nr
import matplotlib.pyplot as plt
from neural_renderer.save_obj import create_texture_image

tV, tF, tT = nr.load_obj('/content/drive/My Drive/Colab Notebooks/myobj.obj', load_texture=True)
img, vert = create_texture_image(tT)
plt.imshow(img)
#nr.save_obj('/content/drive/My Drive/Colab Notebooks/myobjout.obj', tV, tF, tT)

For some reason, plt.imshow and nr.save_obj are directly outputting a white png file, despite the fact that the texture I loaded was not white. Furthermore, the rendered images aren't white either. Please let me know if I am simply using this function incorrectly.

andraugust commented 4 years ago

Something related happened to me. In my save_obj.py line 30 said image = torch.ones_like(image). So my saved textures were all white. Commented this line and then it saved the correct texture. My version is 1.1.3 installed with pip.