Advertisement

Blender Collada Exporter

Started by May 10, 2022 04:27 PM
2 comments, last by RobM 2 years, 6 months ago

Wasn't sure where to post this so feel free to move…

Does anyone know why [the latest version of] Blender seems to mangle its coordinate systems when exporting to Collada? I'm exporting a simple model (which is a new editing widget for my engine):

You can see that Z is up, X is right (and -X is left) and Y is forward. When I export this model from Blender to Collada, it does something very odd. I added a small box just above the blue cone to see how it was being manipulated, like this:

This is how it looks when I export it and load it into my engine (my engine doesn't do anything to the vertices, and the transformation matrix is identity):

You can see that although the geometry initially looks roughly the same, what's happened is a negation of the Z axis (in Blender, i.e. up) and a rotation of 90 around X.. or possibly some other combination. This is partly because Blender is Z up and I work in Y up (Direct X). It's not quite as straight forward as that though.

What I find really hard to get my head around is how the Global Orientation settings work in the Blender Collada Export window - they don't seem to really make sense to how the object is exported. I've tried all combinations of the forward axis and up axis and I can't get it into Collada looking as it should (or as least as I want it).

This must be a known issue unless Collada is so seldom used nowadays that they've given up on maintaining the export plugin. If Collada is dead, what are people using?

What I also tried was exporting from Blender as Collada, converting that to FBX on a few of the conversion websites, e.g. anyconv.com and then viewing that FBX in Windows 3d Viewer and, although the viewer shows it pivoted on the x axis by 90 degrees, the actual mesh data is correct:

After a few more tests with very simple boxes, what I've found is that Blender exports Collada data, no matter how you change your orientation settings, not in keeping with its own coordinate widget. A straight export with default settings (Z up, Y forward) seems to not only switch Y and Z but also to reverse the Z coordinates. So if I export and change the Global Orientation settings to Z forward and Y up, the orientation of the object is correct but the X coordinate is negated.

I need a lie down…

I don't know where the axes are in your engine, but it looks like the y and z are being flipped from Blender to your engine, which of course has the effect of flipping the handedness of the model. In other words, this is exactly what I would expect to happen when moving from the Blender coordinate system (+x=east +y=south +z=up) to (+x=east +y=up +z=south), with no transforms and no adjustments of coordinates.

Blender's Collada exporter is woefully incomplete, but it shouldn't be completely broken. So my guess is that the problem is on your end. Collada is a complex format for whole scenes. Are you ignoring the transforms embedded in the Collada file and just extracting the mesh data?

For simple static geometry, I would recommend the .obj file format. It's more or less human-readable, so you can check the orientation of the exported data by hand. For anything more complex, I would recommend either .gltf or a custom exporter. Collada is not well-supported in Blender.

Advertisement

Thanks for the post. I can't believe I missed the Axis transformation matrix that gets saved out, thanks for pointing that out. It certainly looks like it's doing some manipulation in there.

So if I export a model with bones and animation, would I only apply that transformation matrix to the vertices or would I need to apply it to everything? I can test this of course, but if you already know…

[EDIT] Actually, it looks like however I export the object in Collada format (by changing the Global Orientation settings), the transformation Matrix for the mesh is always identity.

This topic is closed to new replies.

Advertisement