Closed KittenBrix closed 5 years ago
@KittenBrix are you able to post the obj? Negative indices are supported and should be getting the vertices immediately preceding the face, but there might be a bug.
My bad. I didn't see the notification for this. Here are two obj files that seemed to fail in the converter. Now that I think about it, it's possible that the buggy behavior is from an N-gon face in a plane being used. Test3 obj: https://drive.google.com/file/d/1rf1pMkIjz6JrEBOZsWlnkBA0sgSVSl7a/view?usp=sharing Test3 mtl: https://drive.google.com/file/d/1TO0khbINnTXqqFa217Vheian9azp8RF-/view?usp=sharing Test5 obj: https://drive.google.com/file/d/18FOaG2SMriDxPb0DUV7aMFt19JHTgTzO/view?usp=sharing Test5 mtl: https://drive.google.com/file/d/1JS4MnFYMlDvKFXK3PUiK-kcpRGxS7B9t/view?usp=sharing
The code we used to generate these objects abused negative face indices to build vertical faces as it was adding vertices. There's also one face with N vertices in it where all verts lie on the plane. I'll re-process those objs and upload the gltf output as well.
The converted gltfs are found here Test3 gltf: https://drive.google.com/file/d/1G7-Q2Xs9QkzhVQ_jvqpU1jgw2MiVzwhS/view?usp=sharing Test5 gltf: https://drive.google.com/file/d/1T96pLZjQQualZcC8ajy7ZpZY1m3zgMX9/view?usp=sharing
They were both produced using the npm install -g obj2gltf
option and then obj2gltf -i model.obj -o model.gltf
where the model name was changed to match test3 and test5.
I used https://gltf-viewer.donmccurdy.com/ to view the converted models, and it seems that the majority of the vertical faces are not being formed correctly, however the last N-gon face is formed correctly.
It could be a bug specific to n-gons and negative indices. Thanks for the uploading the files.
@KittenBrix I opened a fix here: https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/191
hi all, it seems to be that jsc3d is not able to handle negative vertex indices. Can anybody confirm this behavior or has any workaround for this?
A lot of the .obj files my generator produces make use of negative indexing to add geometry to an existing .obj without re-parsing the original content. In blender they display correctly as intended, likewise with three.js, however when they're (negative vertex indices) present in a file that is converted with the tool, those faces are distorted or seemingly missing.
I can imagine that maybe the face is parsed after all vertices are loaded, which would cause the negative indices to refer to incorrect verts, or perhaps faces with reference to negative indices are ignored? I'm not sure honestly.