WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rating: Thread Rating: 13 votes, 5.00 average. Display Modes
  #1  
Old 11-30-2008, 02:48 AM
reedev reedev is offline
Member
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 16
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
Reply With Quote
  #2  
Old 12-01-2008, 04:22 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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))
Reply With Quote
  #3  
Old 12-03-2008, 11:42 AM
reedev reedev is offline
Member
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 16
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
Reply With Quote
  #4  
Old 12-04-2008, 12:29 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Let me know if this doesn't work for you.
Reply With Quote
  #5  
Old 12-10-2008, 09:43 AM
reedev reedev is offline
Member
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 16
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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 05:26 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC