View Full Version : Different coordinate system for plug-in and vizard API?

11-30-2008, 02:48 AM

In the process of developing my osg based plug-in, I see that different coordinate systems are used for internal and external api. I.e. internal = osg, right handed and external = vizard api, left-handed.

Can anyone confirm this difference and tell me how I should rotate my stuff in the plug-in in order to match the plug-in geometry and the vizard coordinate system? At the moment I use the osg based coordinate system with z up but this does not seem to work.

Thanks a lot

12-01-2008, 04:22 PM
Which OSG methods are you using? Generally to convert a position/vector from Vizard to OSG reference frame you just need to negate the Z value. To convert a quaternion rotation from Vizard to OSG you need to negate the X and Y values.

OSG does use a Z-up convention, but you don't need to deal with that unless you are loading external models using the osgDB API. If this is the case, then you need to rotate the model 90 degrees about the x-axis by placing it under a osg::MatrixTransform with the following value:osg::Matrix::rotate(osg::DegreesToRadians(90 .0),osg::Vec3(-1.0f,0.0f,0.0f))

12-03-2008, 11:42 AM

I am constructing an osg::Geode and osg::Geometry myself. And I fill the vertex coordinates (in a osg::ref_ptr<osg::Vec3Array>) and the rest myself. During this I use the convention X_OSG = X_OpenGL, Y_OSG = -Z_OpenGL and Z_OSG = Y_OpenGL so this uses the right hand coordinate system with z up. When I write the resulting geometry to an .ive (using a 100% osg application) it is just like I expect it to be. However, when I use the same code for directly creating a vizard plug-in, it is not oriented correctly.

So I am not going from Vizard to OSG, I am going from OSG to Vizard. Have you done something to the osg lib that you provide in the Vizard30API?

Thanks a lot,
best regards, Raymond

12-04-2008, 12:29 PM
If you are constructing the geometry within the Vizard plugin, then you just need to use the conversion I mentioned in my previous post:
3D Vectors:

QW_VIZARD = QW_OPENGLLet me know if this doesn't work for you.

12-10-2008, 09:43 AM

(sorry I did not get back sooner on this, I did not work on this problem)

This works indeed, partly. I also have to change the polygon winding, for vertex coordinates, normals and texture coordinates. But now my geometry is oriented properly.

Hmm, this looks rather strange to me. You have changed the internals of osg then? Because in order to get the same results in Vizard via different ways, I have to fill the arrays in different order, inverted or not:
OpenGL coord --> pure osg geometry (osg conversion) --> ive export --> Vizard
OpenGL coord --> Vizard plugin (Vizard conversion as you said) --> Vizard

Can you confirm this? And also, do I need to know about other places where a conversion is needed like this?

Thanks a lot