Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the problem of loading obj file with vertex color #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kaolin/rep/Mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def from_obj(self, filename: str, with_vt: bool = False,
if len(data) == 0:
continue
if data[0] == 'v':
vertices.append(data[1:])
vertices.append([float(d) for d in data[1:]])
elif data[0] == 'vt':
uvs.append(data[1:3])
elif data[0] == 'f':
Expand All @@ -161,7 +161,7 @@ def from_obj(self, filename: str, with_vt: bool = False,
else:
faces.append([int(d) for d in data[1:]])
continue
vertices = torch.FloatTensor([float(el) for sublist in vertices for el in sublist]).view(-1, 3)
vertices = torch.FloatTensor(np.array(vertices, dtype=np.float32))
faces = torch.LongTensor(faces) - 1

# compute texture info
Expand Down