Hi,
my name is thecloser_ and I’m writing a tool for editing a game-scenery due the weeks.
But I have a problem when I try to Import my written OBJ File in Blender. All Vertices are saved correctly in the file, but (I hope) Blender has some Problems with drawing the faces:
Blender creates wrong faces, although all face-indices are correct:
o Object_0002
v -20480 693,742 -10240
v -20480 693,742 -9216
v -19456 693,742 -9216
v -19456 693,742 -10240
f 6 5 7
f 6 7 8
gives the shown result in the Image below (EditMode).
So what is the problem? I readed the Face-Indices from the game file 100% correctly, but I can’t help myself anymore.
Does anybody know why blender creates not 2 normal triangles?
And what can I do to avoid the mistake while writing the OBJ File?
I mean, the face declaration up there is correct, we have 2 triangles and 4 Vertices.
Why does blender draw these triangles incorrect?
Or is there maybe a Logical error by myself? Cause the game can read those indices correct.
Btw: Your code shows the 1st object, but this Problem with the faces occurs from on the 2nd Object until the 460th object
Ok, I attached the code of the first 25 objects - this should be enough to see my problem. The full obj file has ±295MB and ~2.000.000 Triangles.
All vertices are placed correctly, only the faces have this error.
Maybe it’s neccessary to know that I have used absolute indices for faces,
if I remeber right, relative indices are not (?) supported by blender (long time ago since last check, I prefer the absolute ones )
The flipped triangle in your first picture shows me that you may have a problem with the creation order. Faces gets created and read in clockwise mode. When you read them counter clockwise, then the normal points into the other direction, since the writing happens in clockwise mode again.
Check if it helps to change the order of the index.
from this:
f 6 5 7
f 6 7 8
to this:
f 6 5 7
f 6 8 7
EDIT says, hmmm, no, changing the winding order would just flip the normals. I think it’s the wrong vertices that you grab here for your triangles.
I readed the Face-Indices from the game file 100% correctly
Yes, i did red that but it takes certain amount of deduction to realize you’ve used your own code to do that, sorry was not keen enough.
Second, there is no way to tell what is “correct” in your case - is this two overlapping triangles or should it be a quad.
Looking at obj it’s triangles:
and normals are different as it was pointed out by Tiles.
Exporting all triangle faces as individual objects is something which is not done usually looking at how Blender exports objects but i’m not sure i understand how that’s done either. Then again your game object might have separated them for some reasons, idk.
What is clear is that you get in Blender correctly what you have read from your file and that is consistent in different software - Meshlab.
So i do not believe your statement
Blender creates wrong faces, although all face-indices are correct
is correct here.
Have you tried to use this addon
to analyze indices?