Dear mister Osfield,

I currently develop a space simulator working with very hight dynamic 
range data.
During the development I met multiple floatting point number precision 
problems.

For now, I try to solve one of these that come from OpenSceneGraph :
For my scene, I need to use Matrices, Vectors and Quaternions with a 
very big accuracy. (I detail an exemple of osg accuracy problem below).
I wrote a Matrixr, a matrix of real, wich is a Matrix using the GMP library.
The problem is that I can't simply replace all matrices in the code of 
OpenSceneGraph by my Matrixr.
I try to change the "typedef Matrixd Matrix" by "typedef Matrixr Matrix" 
in osg/Matrix, but It does not work because some class don't use the 
Matrix but Matrixd or Matrixf.
Another solution would be to develop new osg::Transform and 
osg::MatrixTransform using the real type and the Matrixr class. But I 
don't know how to make osg considers them as transform node without 
inherit them from the original osg::Transform node.
By the way, I want to know if someone have already try to do this kind 
of thing, and/or if there is an accuracy node kit in development to help me.

Best regard.




Here is a detailed example of my problem :
There is a star far far away from the center of the universe.
For some reasons I MUST have this scene graph :
[rootNode : osg::Group] -> [starTransform : osg::MatrixTransform] -> 
[starModel : osg::Geode] -> ...
The Matrix in the osg::MatrixTransform is a Matrixd that contains a very 
big translation vector, for example at (x=10^20, y=0, z=0) from the 
center of the universe.
I want to move in the universe, close to this star at (x=10^5, y=0, z=0) 
from the star and then at (x=10^20 + 10^5, y=0, z=0) from the center of 
the universe.
To compute the MODELVIEW matrix, osg implicitly compute (x=10^20 + 10^5, 
y=0, z=0) - (x=10^20, y=0, z=0) .
But in fact, osg works like if the camera is in the center of the 
universe at (x=0, y=0, z=0).
Why ? Because osg computes matrix transforms with float and double 
values. In double : 10^20 + 10^5 = 10^20.
So I can't freely move in my universe using Matrixd and that's why I 
need more accuracy.



--
Lamoliatte Stephane.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to