[osg-users] [forum] Huge delays while mouse clicking with many draggers in scene

Robert Osfield robert.osfield at gmail.com
Thu May 7 01:55:22 PDT 2015

Hi Jaap,

The whole scene is tested so that obscured dragger don't get picked
unintentionally.  Each dragger doing the same intersection traversal
is inefficient though, athough as I'm not the original author of
osgManipulator I'd had to do a code review to look at all the
possibilities and consequences.  I'm current deep in another complex
part of the OSG so don't have the spare brain capacity or time to do a
review right away.


On 6 May 2015 at 17:49, Jaap Glas <jaap.glas at dgbes.com> wrote:
> Dear all,
> I am an employee of dGB Earth Sciences, and we use OpenSceneGraph for
> the 3D visualization of our open-source seismic interpretation package
> OpendTect.
> Our scenes may sometimes contain hundreds to thousands of draggers, mostly
> Translate(1D/2D)Draggers. We found that mouse clicking in the scene becomes
> very slow in that case. It turns out that every OSG dragger tries to intersect
> the line from camera eye to mouse position with all objects in the scene in
> order to produce its private list of intersections:
> [osgManipulator/Dragger.cpp:371]
> if ( view->computeIntersections(ea ,intersections,_intersectionMask) )
> My question is whether this is really necessary? I don't see (yet) why
> this list cannot be calculated only once and shared by all OSG draggers.
> Or alternatively, only calculated for draggers that are located under the
> mouse pointer.
> Our current workaround consists of derived dragger classes that overload
> the Dragger::traverse(.) function to test this latter alternative in advance,
> passing the current node path as an extra parameter:
> if ( !view->computeIntersections(*ea,nv.getNodePath(),intersections,
>                                                                                  _intersectionMask) ) continue;
> This reduces the computational order of mouse clicking from quadratic to
> linear with the number of draggers in the scene. And mouse clicking in the
> scene can be done again without huge delay.
> However, the question is whether such a shortcut would apply in the general
> case. Why is the osgManipulator::Dragger class doing this the way it does?
> Best regards,
> Jaap Glas
> -- dr Jaap C. Glas
> -- Software Engineer
> -- dGB Earth Sciences
> -- Phone: +31 53 435155
> -- Email:
> -- Internet: dgbes.com & opendtect.org
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63651#63651
> _______________________________________________
> 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