Closed Trider12 closed 1 year ago
http://paulbourke.net/dataformats/obj/
The spec say nothing when normal/texcoord index is zero(even vertex, but at least it should be an error having zero for vertex index)
How Blender and meshlab handles such .obj data?
How Blender and meshlab handles such .obj data?
I'll test that and come back with the results.
I tested the model in Blender and CAD Assistant (which uses Open Cascade) and both of them imported the model fine, but the faces with the zeroed indices had incorrect shading (like the normals for that face or that particular vertex were inverted).
@Trider12 Thanks! So Blender and other tools seems use zero normal value(0, 0, 0
) or maybe 0, 0, 1
for invalid normal index.
TinyObjLoader's solution would be
f
normal index(and also texcoord index) is zero
PR is much appreciated!
Describe the issue I know that this a strange request, but is it possible to support invalid (i.e. zero) normal indices? Currently I get the following error:
The problematic line looks like this:
And it's not the only such line. In fact, it seems all the hexagons in this file have this issue. The file is generated by Cinema 4D, so it seems that their exporter is bugged (I couldn't find any easy way of reporting this issue to them).
To Reproduce Unfortunately, I can't provide a sample .obj file due to the licensing.
Expected behavior It would be nice if instead of aborting, the library provided invalid normal indices for such vertices, so I could handle these values in my code. Thanks.