[osg-users] _intersectionLimit doesn't seem to be working...

Robert Osfield robert.osfield at gmail.com
Thu Aug 13 10:57:07 PDT 2015

HI Shayne,

The bottlenneck won't be the scene graph nodes but the osg::Geometry
leaves.  When you do intersection tests on geometry you need to test all
triangles in them to find the closest/furthest intersection.  The hints to
just return one hint only help if you know the rest of the geometry is
further away than the present intersection - you can do this at the scene
graph level as you have the bounding volumes you can test but not at the
triangle level.

In the case KdTree, these attached to osg::Geometry and the intersection
routine can use the KdTree for intersections which can speed up
intersections substantially as it provides a fine grained level of tree
based subdivision than the osg::Geometry.  Potentially one could come up
with a more sophisticated intersection algorithm that does the
nearest/furthest test more efficiently as you have the bounding volume
hierarchy - feel free to spend you time and implement one.

What we have the OSG's intersection routines are tools that are general
purpose.  They do a pretty job at making getting the task done efficiently
for a general case, but since they are designed for general usage and
general scene graph structure they can't make the assumptions that one can
make if you have a very specific usage model in mind and very specific type
of pre-prepared data in mind.

It sounds like you are after something this is tailored specific to your
needs, it may be that general purpose techniques available in the OSG
simply aren't going to solve your particular task how you want.

You don't really too much guidance on what your requirements are w.r.t
number of intersections per second, the amount of geometry involved.
Things like geocentric vs flat earth modes make a big difference.  The
later you can use potentially use height fields for testing.  VPB generates
osgTerrain::TerrainTile based terrains by default so provide height fields
for you, so a custom technique utilizing this might be appropriate.


On 13 August 2015 at 15:07, Shayne Tueller <shayne.tueller at hill.af.mil>

> So...I figured out why I was not getting just one intersection returned
> for my LOS tests. Apparently when KdTrees are enabled, intersectionLimit is
> ignored in the LineSegmentIntersector. When I turned off KdTrees, I got
> just one intersection returned but it is still abysmally slow compared with
> using KdTrees. This suggests that time spent traversing the scenegraph is
> the bottleneck vs. traversing KdTrees.
> That being said, KdTrees is still unacceptably slow when doing lots of
> visibility LOS tests on terrain.
> My next question is, is there a way to limit the number of intersections
> returned when using KdTrees like there is for the conventional case?
> Optimally, I would like to get the nearest intersection (or even just one
> intersection) from the start point and then have the intersector bail out
> to save time.
> Any help or input would be appreciated...
> -Shayne
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64754#64754
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150813/f57a861f/attachment-0003.htm>

More information about the osg-users mailing list