[osg-users] Stereo View and makeLookAt()

Andreas Goebel a-goebel at gmx.de
Thu Oct 6 11:17:48 PDT 2016


Hi Robert,

thanks for your answer.

The reason I´m using sceneview is that I started with my application
when Producer was still around, which was very complicated to integrate
into GUI applications.

As this worked and my users got used to the way the scene was
manipulated, I stayed with it. But I´m starting to use osgViewer, for
secondary views on the same scene, a viewer window is opened. For my
main window, I haven´t made the switch yet. There is a lot of
gui-interaction to be taken care of (for instance, menus or dialogs or
tooltips on top of the openGL window) which won´t work out of the box
with osgViewer, as osgViewer isn´t happy when it´s not updated
permamently. At least this was the case when I last tried.

Setting the fusion distance manually improved my situation quite a lot,
thank you for the hint! I liked the way the trackball manipulator
handles this, so I´ll probably try to set it to work like this.

Thanks for your help,

Andreas

Am 06.10.2016 um 18:04 schrieb Robert Osfield:
> Hi Andreas,
>
> Is there a reason why you are using SceneView?  This class hasn't been
> a preferred end user class since around OSG-1.0...  Personally I'd
> recommend user osgViewer, it's interface is much more suitable for
> putting together flexible viewers.
>
> As for mixing and matching ways of setting the view matrix while still
> supporting the built in support stereo, well this all depends upon how
> you go about it.  Normally you'd simply modify the viewer's master
> Camera's view matrix anyhow you want and then the stereo will work
> behind the scenes for you.  The built in Camera manipulators also set
> the FusionDistanceValue automatically, this helps set the effective
> convergence point of the left and right eyes, perhaps this is what the
> difference relative to your case.
>
> One thing to be aware is that certain types of camera manipulators
> favour scaling the FusionDistance to the distance between the eye
> point and center of rotation, the trackball is good example of this,
> while others like the drive or flight manipulators have a fixed
> FusionDistance that one should set to the distance between the eye and
> display system to get a proper 1:1 scaling of the virtual world to
> real world.
>
> Robert.
>
> Robert.
>
> On 6 October 2016 at 16:16, Andreas Goebel <a-goebel at gmx.de> wrote:
>> Hi,
>>
>> to set up my view matrix I use a very simple approach with makeLookAt().
>>
>> Like this:
>>
>>         centerPos = osg::Vec3(0,0,0);
>>         osg::Vec3 viewPos(
>>         cos(viewElev) * sin(viewRot),
>>         cos(viewElev) * cos(viewRot),
>>         sin(viewElev));
>>         osg::Vec3 up;
>>         if ( (viewElev > -1.0*osg::PI_2) && (viewElev < osg::PI_2) )
>>             up = osg::Z_AXIS;
>>         else
>>             up = osg::Z_AXIS*-1.0;
>>         osg::Matrixd look;
>>         viewPos *= 10.0;
>>         look.makeLookAt(viewPos, centerPos, up);
>>         sceneView->setViewMatrix(look);
>>
>>
>> Recently I´ve discovered that in stereo mode all my objects are behind
>> the screen, whereas when I use an osgviewer, for example, it´s possible
>> to pull objects before the screen.
>>
>> I think that usually objects before (0,0,0) appear before the screen.
>>
>> Is it generally impossible to set up the view matrix with makeLookAt in
>> connection with stereo (I use the osg builtin stereo features)?
>>
>> If so, what route should I take? I manipulate view rotation and view
>> elevation with the mouse.
>>
>>
>>
>> Thanks,
>>
>> Andreas
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> _______________________________________________
> 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