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

Incorrect vertex normals when loading obj file #83

Open
NarinderS opened this issue Feb 13, 2024 · 1 comment · May be fixed by #84
Open

Incorrect vertex normals when loading obj file #83

NarinderS opened this issue Feb 13, 2024 · 1 comment · May be fixed by #84

Comments

@NarinderS
Copy link

NarinderS commented Feb 13, 2024

I'm trying to load a very simple obj file:

o Plane
v 0.000000 0.000000 0.000000
v 0.353553 0.353553 0.000000
v 0.353553 -0.353553 0.000000
vn -0.0000 -0.0000 1.0000
vt 0.500000 0.250000
vt 0.500000 0.500000
vt 0.250000 0.500000
s 0
f 2/1/1 1/2/1 3/3/1

When I load the vertex normals using the function load_mesh_vn, I get normals that look like:

[[0 0 1]
 [0 0 0]
 [0 0 0]]

when I would expect something like this instead:

[[0 0 1]
 [0 0 1]
 [0 0 1]]
@NarinderS
Copy link
Author

NarinderS commented Feb 13, 2024

With a slightly more complex obj file:

o Plane
v 0.000000 0.000000 0.000000
v 0.353553 0.353553 0.000000
v 0.353553 -0.353553 0.000000
v 0.000000 -0.707107 -0.000000
v -0.000000 0.707107 0.000000
vn -0.0000 -0.0000 1.0000
vt 0.500000 0.500000
vt 0.250000 0.750000
vt 0.250000 0.500000
vt 0.500000 0.250000
vt 0.750000 0.250000
s 0
f 1/1/1 4/2/1 3/3/1
f 2/4/1 1/1/1 3/3/1
f 5/5/1 1/1/1 2/4/1

I've noticed that sometimes I'll get a nan in the normal matrix,

[[-0.00000000e+00 -0.00000000e+00  1.00000000e+00]
 [ 0.00000000e+00  4.48415509e-44  0.00000000e+00]
 [ 8.53390765e-43  0.00000000e+00  2.80259693e-45]
 [ 0.00000000e+00 -1.03065395e+09  4.02691140e-41]
 [ 7.60905066e-43  0.00000000e+00             nan]]

@NarinderS NarinderS linked a pull request Feb 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant