Hi Simon, I'm afraid I can't spot what might be amiss from your code snippets and description. All I can say is the local origin scheme used by VPB and other tools like osgEarth works extremely well. I've explain how it's structured so don't know what more to add. Perhaps others can provide some advice.
Robert. On 23 September 2013 16:13, Voelcker, Simon < [email protected]> wrote: > Hi, > > thank you for your quick answer. In fact, my project is part of a GIS and > these big transforms are are actually part of such a "local origin" > approach. However, I still have not understood where the inaccuracies that > I see come from. I have, however, reduced the critical part of my scene > graph construction to just a few lines of code: > > // let bigMatrix1 and 2 be my transforms with numbers in the order of > magnitude of a million > // let scene be the subgraph that contains visible geometry > // let root be the top of my scene graph > > > // approach #1 (working fine) > > ref_ptr<MatrixTransform> bigTransform1 = new > MatrixTransform(bigMatrix1); > > ref_ptr<MatrixTransform> bigTransform2 = new > MatrixTransform(bigMatrix2); > > bigTransform1->addChild( scene ); > > bigTransform2->addChild(bigTransform1); > > root = bigTransform2; > > > > // approach #2 (visible inaccuracies) > > ref_ptr<MatrixTransform> singleTransform = new > MatrixTransform(bigMatrix1 * bigMatrix2); > > singleTransform->addChild( scene ); > > root = singleTransform; > > > I have searched my entire project for Vecf's and Matrixf's. I use none of > them. The matrix I set in my subclass of CameraManipulator is also a > Matrixf. As another experiment, I have casted the big matrices down to > Matrixf once, and multiplied them with test vectors. The floating point > errors that came out of this where pretty much in the order of magnitude of > the inaccuracies that I witness when using the above approach #2 (with > doubles). So, it really looks as if OSG was using float when doing my > transforms in 2 steps. > > > I am somewhat desperate for an answer to this... Do you have any ideas > what could go wrong here, or how I could investigate the problem any > deeper? Is it possible to apply a MatrixTransform node to a Vec3 'by hand'? > > > Greets, > > Simon > > > PS: All of this is targeting iOS. Just in case this is important. > > > ________________________________ > Von: [email protected] [ > [email protected]]" im Auftrag von "Robert > Osfield [[email protected]] > Gesendet: Montag, 16. September 2013 19:52 > An: OpenSceneGraph Users > Betreff: Re: [osg-users] MatrixTransforms and MatrixD > > Hi Simon, > > The OSG by default uses double Matrices (osg::Matrix is typedef'd to > osg::Matrixd) for all internal transforms and camera matrices. The > matrices are all accumulated in doubles and passed to OpenGL as doubles. > Most OpenGL drivers will then cast the matrices down to floats when > passing down to the GPU, but as the OSG passes a fully accumulated > modelview matrix the precision is at least the best you can get. > > To best handle scenes with large extents one breaks the scene into > regional tiles, each of which has a local origin and then a MatrixTransform > above the tile subgraph to place it in it's final world coordinates. The > OSG is used widely in the GIS market with many users handling whole earth > database without precision issues. > > So... for you as long as you haven't deliberately compiled the OSG to use > osg::Matrix and a osg::Matrixf then you'll be uses doubles. How you manage > your scene graph and internal transforms will be the key, get it right as I > suggest above then you shouldn't have issues. > > Robert. > > > On 16 September 2013 17:48, Voelcker, Simon < > [email protected]<mailto: > [email protected]>> wrote: > Hi, > > I am using MatrixTransform nodes with matrices that contain quite large > numbers. When I stack two of these transforms, I notice severe floating > point inaccuracies in the scene, although I use double precision matrices > to set up my transform nodes. Is it possible that OSG uses only single > precision here (internally), and if so, how can I force it to use double > precision? > > I know I could multiply my matrices directly and use a single > MatrixTransform node, but I want to avoid this since it breaks my > architecture. > > Thanks in advance, > Simon > _______________________________________________ > osg-users mailing list > [email protected]<mailto: > [email protected]> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

