-
Notifications
You must be signed in to change notification settings - Fork 45
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
FaceColorOutOfBounds error when loading OBJs with mix of colored vertices/textured vertices #54
Comments
Thanks for reporting this issue @Kmschr ! Maybe one option would be to check if the vertex being referenced had vertex colors, then if a mesh references a vertex w/ vertex colors all of its other vertices would be required to have vertex colors. What becomes tricky though (and why tobj requires all or nothing for vertex colors) is that the vertex indices can get mixed up, with the wrong color referenced for a position. For example if the vertices in your file where specified in the opposite order as below, tobj would try to read color data out of bounds. So it would also need to track a map of vertex index -> color index to handle this case. I guess the perf impact of that would only be paid for files with vertex colors, but maybe it's best to split up the OBJ file to separate the meshes with and without vertex colors?
|
I see what you're saying, and I was incorrect in assuming that Blender will always export all of the colored vertices before the textured vertices. I've now seen a couple of examples where that isnt the case. If it doesn't make sense to support this use case in a tiny library I will work on something small to split my files when I need to load them with tobj. |
It would be great to have example OBJs for both cases (colored vertices before/after textured vertices) and add them to this issue for reference. |
Import/export of OBJ is built in to Blender 3.3 onwards
https://docs.blender.org/manual/en/latest/files/import_export/obj.html
When exporting a model with a mix of textured meshes and attribute color meshes, the resulting .obj will start with all colored vertices and end with textured vertices. It appears that when
tobj
encounters any vertex colors at all, it assumes every vertex will have an associated color and goes out of bounds when reaching the textured vertice section.The .obj which fails to load looks something like this:
FYI @soluri
The text was updated successfully, but these errors were encountered: