Possible BUG in Wavefone .OBJ export !

Hello,
I am a C / OpenGL programmer and have written a program that reads a .obj file exported from blender and displays it. (Wavefont obj)

Well, it is all fine apart from the vertex normals. The x values from the vertex normals are never negative. !!! Look at this file. Its a cube exported in obj from blender!!

(I tryed recalc normals outside but this didnt help)


o Cube_Cube
v -0.115971 1.000000 0.998809 
v -0.115971 1.000000 -1.001191 
v -0.115971 -1.000000 -1.001191 
v -0.115971 -1.000000 0.998810 
v 1.884029 1.000000 0.998809 
v 1.884029 0.999999 -1.001191 
v 1.884029 -1.000000 -1.001190 
v 1.884029 -1.000000 0.998809 
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vt 0.0 0.0 0.0
vn 0.231212 0.435275 0.434377 
vn 0.231031 0.434935 -0.435832 
vn 0.231031 -0.434935 -0.435832 
vn 0.231212 -0.435275 0.434377 
vn 0.749581 0.296138 0.295527 
vn 0.749581 -0.296138 0.295527 
vn 0.749310 -0.296031 -0.296642 
vn 0.749310 0.296031 -0.296642 
vn 0.231212 0.435275 0.434377 
vn 0.749581 0.296138 0.295527 
vn 0.749310 0.296031 -0.296642 
vn 0.231031 0.434935 -0.435832 
vn 0.231031 0.434935 -0.435832 
vn 0.749310 0.296031 -0.296642 
vn 0.749310 -0.296031 -0.296642 
vn 0.231031 -0.434935 -0.435832 
vn 0.231031 -0.434935 -0.435832 
vn 0.749310 -0.296031 -0.296642 
vn 0.749581 -0.296138 0.295527 
vn 0.231212 -0.435275 0.434377 
vn 0.749581 0.296138 0.295527 
vn 0.231212 0.435275 0.434377 
vn 0.231212 -0.435275 0.434377 
vn 0.749581 -0.296138 0.295527 
f 1/1/1 2/2/2 3/3/3 4/4/4 
f 5/5/5 8/6/6 7/7/7 6/8/8 
f 1/9/9 5/10/10 6/11/11 2/12/12 
f 2/13/13 6/14/14 7/15/15 3/16/16 
f 3/17/17 7/18/18 8/19/19 4/20/20 
f 5/21/21 1/22/22 4/23/23 8/24/24 

Thats it. I simply deleted everything and ADD->MESH->CUBE
then I went to export->wavefont obj

(using blender 3.34)

Well, what should I say, I appreciate if you help me to find whats up with it

Does it not render correctly after export? It is possible to represent the unit vectors with the x axis always being positive. See image below:

http://members.shaw.ca/rjplus/snapshot3.jpg

In this simple example where the object axis are aligned with the world axis changing the sign of the y axis switches the direction of the x axis

GreyBeard

Well, I tried pressing “set solid” before exporting and it actually produced the correct normals with a cube.
I tried adding a spere and it didnt 't behave as I expected.

Thanks trying to explain the concept to me but I still dont understand fully.

Normals are just vectors in the 3d space.
There should be only one way to represent a vector
for example:
the triangular face 0,0,0 1,0,0 1,1,0
has the vertex normal 0,0,1
right?
I dont understand how there can be another way to represent the same vector.

Or I am totally wrong and the normal vectors are stored relative to something?

or example:
the triangular face 0,0,0 1,0,0 1,1,0
has the vertex normal 0,0,1
right?

I believe that’s correct. Note that you went counter-clockwise around the face. If you went clockwise around the face 0,0,0 1,1,0 1,0,0 the normal would point in the opposite direction (You can verify by doing the cross product). It is possible by changing the order the face coordinates are stored to make the x coord of the normal always be positive. I hope that made more sense – it is also why I asked if it rendered correctly after export.

GreyBeard