-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
❓ Questions on how to use PyTorch3D
Hello, I am trying to color a each mesh faces with different colors. I referred to this issue
I have created a face_colors
(shape: (F, 4)). And then converted it to appropriate input format for TexturesAtlas
using following :
face_tensor = torch.from_numpy(face_colors[:,:3]) # (F, 3) --> (R,G,B) and each value is in 0~1
face_tensor = face_tensor[None, :, None, None, :] # (1, F, 1, 1, 3)
print(face_tensor.shape)
------
output: torch.Size([1, 9999, 1, 1, 3])
Also as shown below the obj has 9999 faces :
verts, faces, aux = load_obj(obj_filename)
print(faces.verts_idx.shape)
--------
output : torch.Size([9999, 3])
And I used following code to create texture, generate mesh, visualize:
verts, faces, _ = load_obj(obj_filename)
textures = TexturesAtlas(atlas=face_tensor)
mesh = pytorch3d.structures.Meshes(
verts=[verts],
faces=[faces.verts_idx],
textures=textures
)
fig = plotly_vis.plot_scene(
{
'test':
{
'mesh' : mesh
}
},
xaxis={"backgroundcolor": bgcolor},
yaxis={"backgroundcolor": bgcolor},
zaxis={"backgroundcolor": bgcolor}
)
fig.show()
The displayed mesh does not have appropriate color. (Its just one color not related to the face_colors
)
Could I ask for advice please?
ZhenglinZhou
Metadata
Metadata
Assignees
Labels
No labels