<div dir="ltr"><div><div><div><div><div>HI Shayne,<br><br></div>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.<br><br></div>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.<br><br></div>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.<br><br></div>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.<br><br></div><div>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.<br></div><div><br></div>Robert<br><div><div><div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 August 2015 at 15:07, Shayne Tueller <span dir="ltr"><<a href="mailto:shayne.tueller@hill.af.mil" target="_blank">shayne.tueller@hill.af.mil</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
That being said, KdTrees is still unacceptably slow when doing lots of visibility LOS tests on terrain.<br>
<br>
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.<br>
<br>
Any help or input would be appreciated...<br>
<br>
-Shayne<br>
<span class=""><br>
------------------<br>
Read this topic online here:<br>
</span><a href="http://forum.openscenegraph.org/viewtopic.php?p=64754#64754" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=64754#64754</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</div></div></blockquote></div><br></div>