Is that true? Setting an invalid bounding sphere will indeed suppress
node-level culling, but I believe the near/far calculation is done at the
Drawable level. See CullVisitor::apply(Geode&).

The usual approach for terrain rendering is to subdivide your globe into
tiles. Then OSG can cull out the tiles that are not in the view, including
far-off tiles or back-facing tiles (by means of the
ClusterCullingCallback). That will bring the far clip plane closer and give
you the z-buffer resolution you need in order to visualize surface
features.

In addition, you can decrease the Camera's near/far ratio; this will give
you a little more near clip space if you still need it.

Glenn Waldron / @glennwaldron


On Fri, Oct 5, 2012 at 7:28 AM, Sergey Polischuk <pol...@yandex.ru> wrote:

> Hi
>
> You can set ComputeBoundingBoxCallback on a geometry to specify whatever
> bounds you want. In your case to ignore earth geometry bound you can set
> its bound to uninitialized bounding box, and it will not make any
> difference to near\far calculations. Note that this thing completely
> disable view frustum culling on a geometry! In order to get it working you
> should write your cull callback and do check vs actual bounds there, if you
> need it.
>
> Code looks like:
>
> class UseInitialBoundsCallback : public
> osg::Drawable::ComputeBoundingBoxCallback
> {
> public:
>         osg::BoundingBox computeBound (const osg::Drawable & drawable)
>         {
>                 osg::BoundingBox brand_new_uninitialized_bbox;
>                 return brand_new_uninitialized_bbox;
>         }
> };
>
> geometry->setComputeBoundingBoxCallback(new UseInitialBoundsCallback);
>
> Cheers, Sergey.
>
> 05.10.2012, 05:11, "Preet" <prismatic.proj...@gmail.com>:
> > On Thu, Oct 4, 2012 at 5:37 PM, Chris Hanson <xe...@alphapixel.com>
> wrote:
> >
> >>  I wanted to avoid specifying the near/far planes manually since the
> >>>  behaviour without the Earth surface geometry is perfect as is. I don't
> >>>  care about the overhead of drawing the surface geometry since its so
> >>>  simple, and I don't want the scene graph to account for the surface
> >>>  geometry (outside of rendering it); the other objects in the scene
> >>>  should determine the camera frustum.
> >>    Due to the way OGL works with near/far, if you want it drawn, you
> need it
> >>  taken into account when computing the near/far planes.
> >>
> >>    Are you just worried about the far plane being set too far?
> >>>  Including geometry for the
> >>  Earth's surface makes the other stuff disappear (and reappear at
> >>  certain angles).
> >>
> >>    It sounds to me like you're not trying to solve the right problem.
> You
> >>  should first determine WHY these other items aren't displayed at times.
> >
> > Sorry if it wasn't clear; the items aren't being displayed because the
> > near and far planes that osg sets creates a frustum that doesn't
> > include them. I need to manually set the near and far planes to see
> > everything.
> >
> > The near and far planes that osg sets without the earth surface
> > geometry is fine. Once you add the surface geometry though, the near
> > and far planes are set such that the items are no long in the view
> > frustum.
> >
> > I was looking for a flag or something that basically tells osg "hey,
> > don't include this node when you do your view frustum calculations"
> > _______________________________________________
> > 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to