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

Import: primitives add too many vertices #294

Closed
scurest opened this issue Feb 11, 2019 · 6 comments
Closed

Import: primitives add too many vertices #294

scurest opened this issue Feb 11, 2019 · 6 comments
Labels
bug Something isn't working importer This involves or affects the import process

Comments

@scurest
Copy link
Contributor

scurest commented Feb 11, 2019

If a primitive has N elements in its POSITION accessor, N vertices always get added to the mesh, even if the indices accessor is, say, [0, 1, 2], so there should actually only be three vertices. This can result in a huge explosion in vertex count.

JoeyVrowl originally noticed this issue and made a test file. See KhronosGroup/UnityGLTF#197, ksons/gltf-blender-importer#29.

extra-verts
Taking apart a corner reveals many extra verts.

@julienduroure julienduroure added bug Something isn't working importer This involves or affects the import process labels Feb 11, 2019
@scurest
Copy link
Contributor Author

scurest commented Feb 22, 2019

@julienduroure The vertex count looks good! Two things:

  1. This breaks the model from Import: distorted animation on joint with node scale of -1 #257. Possibly you need to do something for joints/weights/vertex colors too?
  2. This doesn't only happen when the indices and vertices have different lengths. A quad has indices [0,1,2,2,3,0] with length six but only makes four vertices.

@julienduroure
Copy link
Collaborator

OK, should avoid to code late during the night ... I checked for normals & UV, but forget to check skinning ...

@scurest
Copy link
Contributor Author

scurest commented Feb 22, 2019

Skinning is fixed! But not vertex colors :)

@julienduroure
Copy link
Collaborator

And probably not morphs target too!

@julienduroure
Copy link
Collaborator

@scurest I pushed some fixes, can you please test again?
Thanks for pointing this :)

@scurest
Copy link
Contributor Author

scurest commented Feb 22, 2019

I can confirm vertex colors are fixed!

Unfortunately I have no models that use morph targets, so I can't confirm they work, but the code for them looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working importer This involves or affects the import process
Projects
None yet
Development

No branches or pull requests

2 participants