How to convert matricies/Geometry to OpenGL

Hello Folks,

i am importing a collada document exported from 3d max.
the up-axis says z-up (<up_axis>Z_UP</up_axis>).
As far as i know, that means, that the coordinate system
the scene is stored in not the one opengl is using.
So i have to convert all the matrices that are stored in the
document like this:
<matrix>0 0 1 8.72369 1 0 0 8 0 1 0 7 0 0 0 1</matrix>

how do i do this? I would prefer a solution, where i just have to multiply
the incoming matrix with some kind of flipmatrix, but i am not sure if this is enough.
what would such a matrix look like?

if i convert the matrices i do also have to convert the vertices and the normals, right?

in which way do i have to convert those?

My goal is to have everything in the native OpenGL coordinate system.

I’ve read a suggestion, that not converting at all is preferred. But that would mean, that i have to alter every transformation for every different coordinate system and this is not an option.

Any suggestions or hints are welcome.

thanks in advance.

You can use the Axis converter conditioner (part of Refinery) to convert your data in the UP-axis you need.

Regards

Nice tool, good to have.
But why is it just converting the vertices and not the matrices ?

I don’t get it.

It should be converting everything. If for some odd reason the <matrix> transform was overlooked then please file a bug in the sourceforge project’s bug tracker.

And, OpenGL has no default coordinate system. You can make a Z_UP application if you want. With coordinate systems, as long as all of your data is using the same one then it will look and work correctly. If you mix Z_UP and Y_UP systems you will see problems. Even though OpenGL has no default coordinate system I do understand that it is easier to just think of the world as Y_UP.

-Andy

It does in case not convert the matricies. I filed a bug a few days ago at sf.net but it does not look like anybody’s looking at open bugs. at least not verry frequently ;o)

Thanks for the help. I’ll see what hapens…

Importing it into what?

That is the coordinate system orientation that 3ds Max uses.

This would depend on your application, not OpenGL.

[quote=“marcus”]

Importing it into what?
->Into an OpenGL application, but that does not realy matter. Read on…

That is the coordinate system orientation that 3ds Max uses.
->Right. Exported from max everything is fine. No complain here, just wanted to give you all the neccessary details.

This would depend on your application, not OpenGL.[/quote]
->Thats true, OpenGL is in fact coordinatesystem independent. But as far as i am concerned, i prefer using the OpenGL Coordinate System. What i do not want is to implement every transform for every possible Coordinate System.
Do you agree, that it seams to be wrong behavior, to just convert the geometry and not the Matrices?

When i am importing the converted (converted from Z_UP to Y_UP) collada file into max it looks as weird as in my application. I am using the max im/exporter from feeling software. Maybe this importer does nor hornor the axis tag.

We added the support for converting the <matrix> element in axisconverter conditioner.

We will update it when we finish testing and confirm the changes.

You want to sent your dae files so that we can as least make sure it does what you want it to do?

Thanks,
herbert

COLLADA doesn’t offer arbitrary coordinate system orientation for this very reason. COLLADA offers only three right-handed orientations that are at right-angles to each other.

Both approaches are valid. Converting the geometry can be done simply by suffling the data around, without loosing precision that is important to many users. This is another reason COLLADA offers only three right-angle orientations. Performing mathmatical calculations can be a lot simpler to implement but on the other hand can loose precision.

That is a possibility because there is an open bug about this at Feeling Software’s website.

http://www.feelingsoftware.com/bugzilla … .cgi?id=64

Maybe you can post to that bug and add you information to it?

I posted a new COLLADA Refinery 2.0.3.
The Axisconverter will support matrix transforms.

If it doesn’t work for your content.
Please sent me your content, so that I can do further debug.

Thanks,
Herbert