obj file coordinate is different from what osgearth display

35 views
Skip to first unread message

wu

unread,
Apr 28, 2020, 5:03:38 AM4/28/20
to OpenSceneGraph Users
obj file coordinate is different from what osgearth display!
i use osgearth  display my pipe (wgs84)
pipe display correct,but  obj Exported is Incorrect。I checked some information but found no reason!

Boitumelo Ruf

unread,
Apr 28, 2020, 5:12:29 AM4/28/20
to OpenSceneGraph Users
Have you checked the osgEarth forum: http://forum.osgearth.org/

osgEarth uses an Earth-Centered-Earth-Fixed (ECEF) eucledian coordinate system. Maybe you would need to transform the coordinates inside your .obj file first.

wu

unread,
Apr 28, 2020, 6:29:01 AM4/28/20
to OpenSceneGraph Users
my osgearth coordinate system use the wgs84 not ECEF

Boitumelo Ruf

unread,
Apr 28, 2020, 7:02:27 AM4/28/20
to OpenSceneGraph Users
Yes, but internally it will transform the wgs84 coordinates to ECEF in order to place them inside the eucledian coordinate system of osg. Look at: http://forum.osgearth.org/LIDAR-data-visualization-td7592224.html

wu

unread,
Apr 28, 2020, 11:49:35 PM4/28/20
to OpenSceneGraph Users
Can you provide some ideas? I am a novice for osgearth. I use readNodeFile fnction to read obj  file and display (wgs84), then use writeNodeFile to write obj file then display in cesiumlab.

Boitumelo Ruf

unread,
Apr 29, 2020, 4:09:24 AM4/29/20
to OpenSceneGraph Users
So what I have done in reading a point cloud from a .ply file with point coordinate in WGS84 (Lat-Long-Height), is that I iterate over each vertex and convert the coordinates into ECEF format given the functions from osgEarth:

for(uint elementIdx = 0; elementIdx < vertArray->getNumElements(); ++elementIdx)
{
      //--- read current vertex from array
osg::Vec3d llhVert = static_cast<osg::Vec3>((*vertArray)[elementIdx]);

      //--- initialize geopoint
      osgEarth::GeoPoint geoPoint;
      geoPoint = osgEarth::GeoPoint(osgEarth::SpatialReference::get("epsg:4326", "egm96"),
                                    llhVert.x(), llhVert.y(), llhVert.z(),
                                    osgEarth::ALTMODE_ABSOLUTE);

      //--- convert geopoint into ecef point
      osg::Vec3d ecefVert;
      geoPoint.toWorld(ecefVert);

      //--- save vertex
      (*vertArray)[elementIdx] = ecefVert;

}
Reply all
Reply to author
Forward
0 new messages