Re: [osg-users] double vs. float precision in camera position + osg::MatrixTransform question
On Tue, Mar 4, 2008 at 6:19 AM, Roni Rosenzweig [EMAIL PROTECTED] wrote: Hi Robert I found the problem and fixed it: Turns out is wasn't the MatrixTransform but how I set the camera position. I used: getCamera()-setViewMatrixAsLookat(eye, center, up) which receives osg::Vec3f instead of osg::Vec3d. when I switched to: getCamera()-setViewMatrix(osg::Matrixd::lookat(eye, center, up)) (which receives osg::Vec3d) the problem was completely solved. Is there a reason why setViewMatrixAsLookat doesn't receive osg::Vec3d?? An oversight... I'll add it in now as an option. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] double vs. float precision in camera position + osg::MatrixTransform question
On Tue, Mar 4, 2008 at 8:56 AM, Robert Osfield [EMAIL PROTECTED] wrote: An oversight... I'll add it in now as an option. I've just tweak Camera::setViewAsLookAt(..) so that it now uses Vec3d rather than Vec3, and have checked in this change. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] double vs. float precision in camera position +osg::MatrixTransform question
Thanks :-) Roni - Original Message - From: Robert Osfield [EMAIL PROTECTED] To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Sent: Tuesday, March 04, 2008 10:56 AM Subject: Re: [osg-users] double vs. float precision in camera position +osg::MatrixTransform question On Tue, Mar 4, 2008 at 6:19 AM, Roni Rosenzweig [EMAIL PROTECTED] wrote: Hi Robert I found the problem and fixed it: Turns out is wasn't the MatrixTransform but how I set the camera position. I used: getCamera()-setViewMatrixAsLookat(eye, center, up) which receives osg::Vec3f instead of osg::Vec3d. when I switched to: getCamera()-setViewMatrix(osg::Matrixd::lookat(eye, center, up)) (which receives osg::Vec3d) the problem was completely solved. Is there a reason why setViewMatrixAsLookat doesn't receive osg::Vec3d?? An oversight... I'll add it in now as an option. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] double vs. float precision in camera position + osg::MatrixTransform question
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 [EMAIL PROTECTED] 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 (3, 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@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] double vs. float precision in camera position + osg::MatrixTransform question
Hi Robert I found the problem and fixed it: Turns out is wasn't the MatrixTransform but how I set the camera position. I used: getCamera()-setViewMatrixAsLookat(eye, center, up) which receives osg::Vec3f instead of osg::Vec3d. when I switched to: getCamera()-setViewMatrix(osg::Matrixd::lookat(eye, center, up)) (which receives osg::Vec3d) the problem was completely solved. Is there a reason why setViewMatrixAsLookat doesn't receive osg::Vec3d?? Roni On 3/3/08, Robert Osfield [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] 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 (3, 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@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] double vs. float precision in camera position + osg::MatrixTransform question
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 (3, 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@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org