Skip to content

Commit 9acdd67

Browse files
bottlerfacebook-github-bot
authored andcommitted
fix obj material indexing bug #1368
Summary: Make the negative index actually not an error fixes #1368 Reviewed By: das-intensity Differential Revision: D62177991 fbshipit-source-id: e5ed433bde1f54251c4d4b6db073c029cbe87343
1 parent 3f428d9 commit 9acdd67

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pytorch3d/io/obj_io.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,7 @@ def _load_obj(
649649
# Create an array of strings of material names for each face.
650650
# If faces_materials_idx == -1 then that face doesn't have a material.
651651
idx = faces_materials_idx.cpu().numpy()
652-
face_material_names = np.array(material_names)[idx] # (F,)
653-
face_material_names[idx == -1] = ""
652+
face_material_names = np.array([""] + material_names)[idx + 1] # (F,)
654653

655654
# Construct the atlas.
656655
texture_atlas = make_mesh_texture_atlas(

0 commit comments

Comments
 (0)