Blender export to wavefront BUG!

Hi,
the export output to left handed (+Z, Yup) is wrong: The X axis is flipped which causes the objects to be mirrored horizontally!

Only workaround would be to scale the object(s) x -1, then flip the normals for each object before any joinning! Not practicall at all!

Also, it cannot be post corrected externally simply by reversing back the X axis, because it is tied to the way normals were calculated. In other words, this export is useless!

So, two options remain:
a) is there by chance someone capable/willing to correct this python addon?

b) since (a) might take a lot of time, is there an external (free) app to convert Blender’s output (e.g 3ds or other correct export -if any) to correct +Z Yup OBJ? Anyone tried this before?

Have you tried actually changing the orientation using the built int settings…?

BTW, which 3D application is reading the OBJ file wrong? I assume you are trying to import the OBJ into another piece of software and that is where you encounter the problem.

Attachments


Have you tried actually changing the orientation using the built int
settings…?
Yes, I used the following settings:

-Apply Modifiers
-Include Normals
-Include UVs
-Triangulate Faces
-Objects as OBJ Objects
-Scale 1.0
+Z forward
Y up
Auto

BTW, which 3D application is reading the OBJ file wrong? I assume you are trying
to import the OBJ into another piece of software and that is where you encounter
the problem.
I import the object into a Flash web app I’m writing. In order to check the Blender’s export for sure, I’ve made the attached simple object (triangle) as follows:

X, Y, Z:
0.5, 0.5, -1 (right)
0, -1, 0 (front)
-1, 1, 1 (left)

So for left-handed coordinates where +Z points toward the scene and Y is up it should be:

0.5,-1, 0.5 (right)
0, 0, -1 (front)
-1, 1, 1 (left)

so I chose on the exporter:

+Z forward
Y up

while Blender outputs the following file instead:

Blender v2.62 (sub 0) OBJ File: ‘TEST_TRIANGLE.blend’

www.blender.org

o TEST_TRIANGLE_Plane
v -0.500000 -1.000000 0.500000
v 0.000000 0.000000 -1.000000
v 1.000000 1.000000 1.000000

vt 0.931494 0.483834
vt 0.493169 0.162781
vt 1.307954 0.793272
vn 0.808283 -0.577349 -0.115452
s 1
f 1/1/1 2/2/1 3/3/1

…which shows clearly that the x component is flipped!

Attachments

TEST_TRIANGLE.blend (346 KB)

You have a test case that demonstrates the bug and blender.org has a bug tracker that loves test cases.

Match made in heaven methinks…

This might not be a bug but an enhancement request. As you are aware, Blender uses a right-hand coordinate space. It is possible to specify that “Z+ forward, Y+ up” in a right hand coordinate space. This causes the X-axis to mirror (or 180 degree rotation around the Y-axis if you prefer).

It is not clear if this export was intended to generate a left-hand or right-hand coordinate space. I doubt that you will be able to get Blender to export a left-hand coordinate space with this method. I looked at the code and it is transforming the output based on an “axis_conversion” method that takes an “up” and “forward” vector. Since there is no parameter to specify a hand-change then this will always generate a right-hand output.

How many objects do you have to export? If it is just a few then I would recommend:

  • Save your file
  • Rotate your object 180 degrees around the Y-axis
  • Apply the rotation
  • Export with “Z+ forward, Y+ up”
  • Discard the changes

If you have more models to output, you can try posting what your needs are and somebody might write a script or modify the export script to dump left-hand models for you.

On second thought, you cannot just rotate around the Y-Axis as that will introduce other issues. You will have to get a script that manually mirrors the X coordinates to put it into left-handed space.

This might not be a bug but an enhancement request. It is possible to specify that “Z+ forward, Y+ up” in a right hand coordinate space. This causes the X-axis to mirror (or 180 degree rotation around the Y-axis if you prefer).
Well, it is possible, as is to direct the coordinates diagonally to the screen, but nobody does this, except if it’s a bug or a function made to confuse! Most left-hand applications assume +Y up and +Z forward, and most right-hand ones assume +Z backwards or Up. Everything else can only be used to confuse further! The best would be to use a single coordinate ‘hand’ and the same Up axis, since there is no difference at all. It is already counter productive as is.

How many objects do you have to export?
I’ll have to convert too many models for a long time period as I’ll be making them…

On second thought, you cannot just rotate around the Y-Axis as that will introduce other issues.You will have to get a script that manually mirrors the X coordinates to put it into left-handed space.

And flip all the normals too, as I wrote earlier.

I have lost two days already searching for a third solution and I can’t wait until that happens, so I decided to convert my code to right-handed since there is a chance that it might be considered an “enhancement request” as you said… thanks anyway.

I forgot to mention that while I was searching I found a nice little app (free) that can be used to examine and repair meshes (mostly intended for 3D scanned data) and it can import and export to many formats. I’m not sure if Blender can do all these or not but there is a chance that does something better, or more conveniently. It is called MeshLab (v1.3.1). http://meshlab.sourceforge.net/