Re: [osg-users] Configuring OSG for stereo

2009-03-11 Thread Eric Heft
Robert, 

The problem I was having with convergence/parallax distance was because I was 
directly setting the camera via

viewer-getCameraManipulator()-setByMatrix(  R2 * R1 );

So even though I tried setting FusionDistance nothing was happening because the 
manipulators center point was not getting used. 

Switching to 

viewer-getCameraManipulator()-computePosition (eye,center,up);
viewer-getCameraManipulator()-home(0);

works as expected and problem solved!

Thank you.
Eric

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8299#8299





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Configuring OSG for stereo

2009-03-08 Thread Robert Osfield
Hi Eric,

On Sun, Mar 8, 2009 at 3:25 AM, Eric Heft osgfo...@tevs.eu wrote:
 Robert,

 I converted all the measurements to meters. As I suspected there were no 
 changes since the units should fall out of the calculations.

Only if you have all coords in the same units, model and screen
parameters.  Most models are in meters, the OSG defaults are all in
meters so if you want things to work out the box it's best to stick to
meters otherwise if you miss one parameter you can get a mixture of
units.

 So the question remains. What controls the depth plane?

Um another ambiguous set of language  do you mean the
convergence/parallax distance?

 If I use the trackball manipulator and press space the depth plane is set to 
 the center of the objects volume so next week I'll look into what it is doing.

The trackball manipulator tells the viewer to scale the interoccular
distance by the distance between the eye point and the center of
rotation of the trackball.  This mode allows you to view molecules up
to planets without having to dynamically manage the interoccular
distance yourself.  The FusionDistance is the name given to the
distance between the eye point and center of rotation/pont at which
the left and right eye views overlap (which is the image plane of the
display system), in hindsight parallax distance would have been a
better name...

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Configuring OSG for stereo

2009-03-07 Thread Eric Heft
Robert,

I converted all the measurements to meters. As I suspected there were no 
changes since the units should fall out of the calculations. 

So the question remains. What controls the depth plane? 

If I use the trackball manipulator and press space the depth plane is set to 
the center of the objects volume so next week I'll look into what it is doing. 

Thank you,
Eric

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8064#8064





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Configuring OSG for stereo

2009-03-06 Thread Robert Osfield
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 osgfo...@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,100);
        else
                viewer-getCamera()-setProjectionMatrixAsPerspective(
                        FOV_Y,FOV_X/FOV_Y,0.01,100);
 }




 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@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] Configuring OSG for stereo

2009-03-05 Thread Eric Heft
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,100);
else
viewer-getCamera()-setProjectionMatrixAsPerspective(
FOV_Y,FOV_X/FOV_Y,0.01,100);
}




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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org