facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.53k stars 1.28k forks source link

How do I use TextureUV with multiple textures #1017

Open lishi0927 opened 2 years ago

lishi0927 commented 2 years ago

Dear Authors, I'm glad to use Pytorch3d for my research about differentiable rendering. But now I'm confusion about how to use TextureUV with multiple textures. I want to train two textures with our custom shader, for example, lightmap and albedomap. I use these two textures in our custom shader to fit the ground truth images, But I find TextureUV supports only one image, TextureAtlas supports multiple textures but it can't be visited through coordinate. Could you give me some suggestions to acquire these two textures through neural network? Thank you.

gkioxari commented 2 years ago

TexturesUV supports only one image for now.

lishi0927 commented 2 years ago

Thank you for your reply. I have two ideas about this enhancement. One is that we can write a new type that combine Textureatlas and Textureuv, the other is to modify the Mesh class to support texture lists. Could you give me some suggestions about this realization, which one would be better or you have best plans?

bottler commented 2 years ago

Both TexturesAtlas and TexturesUV support batches, but these correspond to the batch of meshes. So actually I don't think looking at TexturesAtlas will help.

I think an easy solution would be to create a new TexturesBase subclass which owns a list of TexturesBase objects. Its sample_textures would call sample_textures on each element of the list and concatenate the results along the channel axis. This requires little or no change to existing classes.

(If the UV coordinates are shared then you can use a single mega TexturesUV with many channels.)

lishi0927 commented 2 years ago

Thank you. I have ever tried to expand the length of tensor in TextureUV to 3 * texture_num. But this enhancement can't support different resolutions. I will try your suggestions.