Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to convert matricies/Geometry to OpenGL

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    4

    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.

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    You can use the Axis converter conditioner (part of Refinery) to convert your data in the UP-axis you need.

    Regards

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Posts
    4
    Quote Originally Posted by remi
    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.

  4. #4
    Senior Member
    Join Date
    Aug 2005
    Location
    California
    Posts
    165
    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

  5. #5
    Junior Member
    Join Date
    Mar 2007
    Posts
    4
    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...

  6. #6
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: How to convert matricies/Geometry to OpenGL

    Quote Originally Posted by thronerbe
    i am importing a collada document exported from 3d max.
    Importing it into what?
    Quote Originally Posted by thronerbe
    the up-axis says z-up (<up_axis>Z_UP</up_axis>).
    That is the coordinate system orientation that 3ds Max uses.
    Quote Originally Posted by thronerbe
    As far as i know, that means, that the coordinate system
    the scene is stored in not the one opengl is using.
    This would depend on your application, not OpenGL.

  7. #7
    Junior Member
    Join Date
    Mar 2007
    Posts
    4

    Re: How to convert matricies/Geometry to OpenGL

    Quote Originally Posted by marcus
    Quote Originally Posted by thronerbe
    i am importing a collada document exported from 3d max.
    Importing it into what?
    ->Into an OpenGL application, but that does not realy matter. Read on...
    Quote Originally Posted by thronerbe
    the up-axis says z-up (<up_axis>Z_UP</up_axis>).
    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.
    Quote Originally Posted by thronerbe
    As far as i know, that means, that the coordinate system
    the scene is stored in not the one opengl is using.
    This would depend on your application, not OpenGL.
    ->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.

  8. #8
    Member
    Join Date
    Feb 2005
    Location
    San Jose, CA
    Posts
    63
    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

  9. #9
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: How to convert matricies/Geometry to OpenGL

    Quote Originally Posted by thronerbe
    What i do not want is to implement every transform for every possible Coordinate System.
    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.
    Quote Originally Posted by thronerbe
    Do you agree, that it seams to be wrong behavior, to just convert the geometry and not the Matrices?
    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.

  10. #10
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771

    Re: How to convert matricies/Geometry to OpenGL

    Quote Originally Posted by thronerbe
    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.
    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?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •