[osg-users] Stereo View and makeLookAt()
Robert Osfield
robert.osfield at gmail.com
Thu Oct 6 09:04:21 PDT 2016
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
More information about the osg-users
mailing list