[osg-users] Frustum specialists look here.

Robert Osfield robert.osfield at gmail.com
Fri Oct 19 02:11:17 PDT 2007


HI Johan,

What is the high level viewer set up?  Is this the master camera you
are setting? Do you have slaves?

Could the resize of the window be a factor here, I note that you are
turning off the LensAutoAspect in Producer, not doing the equivilant
on the OSG side i.e.

 camera->setProjectionResizePolicy(osg::Camera::FIXED);

Robert.


On 10/19/07, Johan Johnsson <eslave at gmail.com> wrote:
> i did like this at OSG version 1x (this gets a correct frustum)
>
>
> Producer::Camera* camera = new Producer::Camera();
>
> // Set frustum
> camera->setLensFrustum(left, right, bottom, top, ch.frustum.nearClipping,
> ch.frustum.farClipping);
>
>
> // Set projection rectangle
> camera->setProjectionRectangle(
>              static_cast<float>(ch.projectionRect.left),
>              static_cast<float>(ch.projectionRect.right),
>              static_cast<float>(ch.projectionRect.bottom),
>              static_cast<float>(ch.projectionRect.top));
>
> camera->setBlockOnVsync(true); // Try to use vertical sync.
> camera->setShareLens(false); // Use unique lenses.
> camera->setShareView(true); // All cameras share the same camera view.
> camera->setLensAutoAspect(false); // Can't be used bacause of mirror
> channels.
>
>
>
> This hos its done in OSG 2.x
>
> // Set frustum
> camera->setProjectionMatrixAsFrustum(left, right, bottom, top,
> ch.frustum.nearClipping, ch.frustum.farClipping);
>
> // Set Viewports - if first cam set as master cam
> camera->setViewport(new osg::Viewport(
>                      (pr.left * width),
>                      (pr.bottom * height),
>                      (pr.right - pr.left) * width,
>                      (pr.top - pr.bottom) * height));
>
>
>
> On Thu, 18 Oct 2007 11:09:40 +0200, Robert Osfield
> <robert.osfield at gmail.com> wrote:
>
> > Hi Johan,
> >
> > It's really hard to know what is up for the little snippets of info
> > provided.  In theory osgViewer's Camera setup should be just a pass
> > through - it'll set what you provided.  The only time that osgViewer
> > will change the projection matrix is when the window is resized.
> >
> > Could you modify one of the OSG examples to reproduce this problem and
> > then post this so others can have a look at it.
> >
> > Robert.
> >
> > On 10/18/07, Johan Johnsson <johanj at autosim.no> wrote:
> >> osgviewer
> >>
> >> On Thu, 18 Oct 2007 09:47:38 +0200, Adrian Egli <3dhelp at gmail.com>
> >> wrote:
> >>
> >> > is the appliction based on the osgViewer? or producer ?
> >> >
> >> > sorry i still not understand what are the differents, same code used
> >> for
> >> > both version (i guess)
> >> >
> >> > 2007/10/18, Johan Johnsson <johanj at autosim.no>:
> >> >>
> >> >>          double left   = ((ch.frustum.left)   *
> >> ch.frustum.nearClipping
> >> >> /
> >> >> abs( ch.frustum.distance));
> >> >>          double right  = ((ch.frustum.right)  *
> >> ch.frustum.nearClipping
> >> >> /
> >> >> abs( ch.frustum.distance));
> >> >>          double top    = ((ch.frustum.top)    *
> >> ch.frustum.nearClipping
> >> >> /
> >> >> abs( ch.frustum.distance));
> >> >>          double bottom = ((ch.frustum.bottom) *
> >> ch.frustum.nearClipping
> >> >> /
> >> >> abs( ch.frustum.distance));
> >> >>
> >> >>          camera->setGraphicsContext(gc.get());
> >> >>          camera->setProjectionMatrixAsFrustum(left, right, bottom,
> >> top,
> >> >> ch.frustum.nearClipping,
> >> ch.frustum.farClipping);
> >> >>
> >> >> // offset comes further down.
> >> >>
> >> >>
> >> >>
> >> >> On Thu, 18 Oct 2007 09:39:53 +0200, Adrian Egli <3dhelp at gmail.com>
> >> >> wrote:
> >> >>
> >> >> > Hi Johan,
> >> >> >
> >> >> > quite hard to estimate what's going wrong, how do calc the
> >> projection
> >> >> > matrix, near far clipp, viewmatrix, and so on.
> >> >> >
> >> >> > /adegli
> >> >> >
> >> >> > 2007/10/18, Johan Johnsson <eslave at gmail.com>:
> >> >> >>
> >> >> >> Hei !
> >> >> >>
> >> >> >> I dont know if its actually possible to tell exactly where the
> >> >> >> difference
> >> >> >> is when comparing two viewfrustums.
> >> >> >> We did get another frustum after the migration from osg1x to
> >> osg2x.
> >> >> >> I attach 2 pictures showing them. (they get exactly the same
> >> values,
> >> >> >> from
> >> >> >> a config file)
> >> >> >>
> >> >> >> --
> >> >> >> Mr. Johan Johnsson
> >> >> >> AutoSim AS, Strandveien 106, 9006 Tromsø
> >> >> >> Visit us at http://www.autosim.no
> >> >> >> _______________________________________________
> >> >> >> osg-users mailing list
> >> >> >> osg-users at lists.openscenegraph.org
> >> >> >>
> >> >>
> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Mr. Johan Johnsson
> >> >> AutoSim AS, Strandveien 106, 9006 Tromsø
> >> >> Visit us at http://www.autosim.no
> >> >> _______________________________________________
> >> >> osg-users mailing list
> >> >> osg-users at lists.openscenegraph.org
> >> >>
> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >>
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Mr. Johan Johnsson
> >> AutoSim AS, Strandveien 106, 9006 Tromsø
> >> Visit us at http://www.autosim.no
> >> _______________________________________________
> >> 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
>
>
>
> --
> Mr. Johan Johnsson
> AutoSim AS, Strandveien 106, 9006 Tromsø
> Visit us at http://www.autosim.no
> _______________________________________________
> 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