fix obj material indexing bug #1368

Summary:
Make the negative index actually not an error

fixes https://github.com/facebookresearch/pytorch3d/issues/1368

Reviewed By: das-intensity

Differential Revision: D62177991

fbshipit-source-id: e5ed433bde1f54251c4d4b6db073c029cbe87343
This commit is contained in:
Jeremy Reizenstein 2024-09-13 02:00:49 -07:00 committed by Facebook GitHub Bot
parent 3f428d9981
commit 9acdd67b83

View File

@ -649,8 +649,7 @@ def _load_obj(
# Create an array of strings of material names for each face.
# If faces_materials_idx == -1 then that face doesn't have a material.
idx = faces_materials_idx.cpu().numpy()
face_material_names = np.array(material_names)[idx] # (F,)
face_material_names[idx == -1] = ""
face_material_names = np.array([""] + material_names)[idx + 1] # (F,)
# Construct the atlas.
texture_atlas = make_mesh_texture_atlas(