#1
|
|||
|
|||
Different coordinate system for plug-in and vizard API?
Hi,
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 Raymond |
#2
|
|||
|
|||
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: Code:
osg::Matrix::rotate(osg::DegreesToRadians(90.0),osg::Vec3(-1.0f,0.0f,0.0f)) |
#3
|
|||
|
|||
Hi,
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 |
#4
|
|||
|
|||
If you are constructing the geometry within the Vizard plugin, then you just need to use the conversion I mentioned in my previous post:
Code:
3D Vectors: X_VIZARD = X_OPENGL Y_VIZARD = Y_OPENGL Z_VIZARD = -Z_OPENGL Quaternion: QX_VIZARD = -QX_OPENGL QY_VIZARD = -QY_OPENGL QZ_VIZARD = QZ_OPENGL QW_VIZARD = QW_OPENGL |
#5
|
|||
|
|||
Hi,
(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 and 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 Raymond |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Should my PPT Machine have a Vizard license? (Urgent) | Brandyn | Precision Position Tracker (PPT) | 3 | 05-05-2008 12:06 PM |
Vizard and Augmented Reality | realvision | Vizard | 4 | 04-04-2008 11:59 AM |
Vizard won't run | wouters | Vizard | 5 | 02-05-2008 12:12 PM |
Fall 2007 release of Vizard R3 | 3 D | Announcements | 0 | 10-15-2007 05:50 PM |
vizard and java -> jython? | Johannes | Vizard | 10 | 06-28-2005 11:23 AM |