[osg-users] double vs. float precision in camera position + osg::MatrixTransform question

Robert Osfield robert.osfield at gmail.com
Mon Mar 3 01:29:33 PST 2008


Hi Roni,

The OSG defaults to using Matrxd for the Matrix definition.  The
MatrixManipulators generally use doubles internally as well.  All for
the reason of avoid problems with precision.   The intersection code
can be a problem area though as its currently done in floats, other
than this possible area, I'm not sure what code you might be having
issue with.

What camera manipulator are you using?

Robert.

On Mon, Mar 3, 2008 at 7:49 AM, Roni Rosenzweig <roniros at gmail.com> wrote:
> Hello
>
> I made a small demo using osg 2.2, of an object moving on a terrain with a
> camera looking at it from above, and lowering towards it.
> When the location of the object+camera is near the (0,0,0) the demo works
> smoothly.
> However when their location is far (for example at location (30000, 5000,
> 100)), there are "vibrations" in the move of both the camera and the object.
>
> I narrowed it down to a precision problem between float and double, and made
> it much better using Vec3d/Matrixd instead of Vec3f/Matrixf for the camera
> position.
> However for the object I'm using a osg::MatrixTransform, which uses a Matrix
> and not a Matrixd. I think this is causing the precision problems in the
> object movement.
>
> Did anyone else bump into this problem?
> Is there a version of osg::MatrixTransform using a Matrixd for double
> precision?
> _______________________________________________
>  osg-users mailing list
>  osg-users at lists.openscenegraph.org
>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


More information about the osg-users mailing list