[osg-users] Configuring OSG for stereo

Robert Osfield robert.osfield at gmail.com
Fri Mar 6 00:49:01 PST 2009


HI Eric,

The units are assumed to be meters, so please just convert your values
to meters.

Robert.

On Thu, Mar 5, 2009 at 11:57 PM, Eric Heft <osgforum at tevs.eu> wrote:
> What sets the 'depth' plane when using stereo?
>
> >From the docs you have measured and entered values for the following in inches instead of meters.
>
> setEyeSeparation(EyeSeperation );
> setScreenDistance(ScreenDistance);
> setScreenHeight(ScreenHeight);
> setScreenWidth(ScreenWidth);
> setProjectionMatrixAsPerspective(...);
> setFusionDistance(mode,value);
>
> I get stereo, its just that the objects are not in the right depth plane.
>
> My screen is 146 inches from the projector. I place an object at (0,0,-146) and while the size of the object is correct on the screen. The object is way behind the surface of the screen ( lots of overlap ). I have to move the object to (0,0,-14) to get zero overlap/disparity.
>
> -- Details --
>
> Using WinXP + OSG 2.5.1 + 2 Projector horizontal span setup running 2048 x 768 resolution.
>
> I load an object created in blender that is a wire frame box 5 units from edge to edge.
>
> The test application lets me change the following parameters on the fly.
>
> ScreenDistance=146.00
> ScreenHeight=64.00
> ScreenWidth=87.00
> EyeSeperation=2.50
> ObjectDistance=146.00
>
> With EyeSeperation set to 0.00 , the wire frame box appears on the projector screen and measures very close to the expected size of 5 inches across.
>
> When any of the parameters change.  I call this:
>
> Code:
>
> void ResetGeometry(void)
> {
>        float FOV_X = 2.0*atan2(ScreenHeight/2.0,(double)ScreenDistance)*180.0/3.14159;
>        float FOV_Y = 2.0*atan2(ScreenWidth/2.0,(double)ScreenDistance)*180.0/3.14159;
>        osg::DisplaySettings::instance()->setStereo(stereo);
>        osg::DisplaySettings::instance()->setEyeSeparation(EyeSeperation );
>        osg::DisplaySettings::instance()->setScreenDistance(ScreenDistance);
>        osg::DisplaySettings::instance()->setScreenHeight(ScreenHeight);
>        osg::DisplaySettings::instance()->setScreenWidth(ScreenWidth);
>        viewer->setFusionDistance(osgUtil::SceneView::FusionDistanceMode::USE_FUSION_DISTANCE_VALUE,ScreenDistance);
>        printf("FusionDistance = %6.2f\n",viewer->getFusionDistanceValue());
>
>        if (stereo)
>                viewer->getCamera()->setProjectionMatrixAsPerspective(
>                        FOV_Y,2.0*FOV_X/FOV_Y,0.01,1000000);
>        else
>                viewer->getCamera()->setProjectionMatrixAsPerspective(
>                        FOV_Y,FOV_X/FOV_Y,0.01,1000000);
> }
>
>
>
>
> At the beginning of the program I call this. ( this will be modified once all the other setup is verified )
>
>
> Code:
>
> void SetView(void)
> {
>        static osg::Vec3 vtrs;
>        static osg::Quat qrot;
>        osg::Matrixd R1;
>        osg::Matrixd R2;
>
>                qrot.makeRotate( osg::DegreesToRadians(0.0), osg::Vec3(1,0,0) );
>                vtrs.set( 0, 0, 0);
>                R1.makeRotate( qrot );
>                R2.makeTranslate( vtrs );
>                viewer->getCameraManipulator()->setByMatrix(  R2 * R1 );
> }
>
>
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=8018#8018
>
>
>
>
>
> _______________________________________________
> 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