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

Christian Buchner christian.buchner at gmail.com
Thu May 7 01:36:28 PDT 2015

We've run into a very similar issue recently, with hundreds of inividually
movable objects in a scene.

Our ugly workaround was to require a modifier key, e.g. Alt to be pressed
if one really intended to move
an object. So at least the camera controls when not pressing the modifier
remained smooth.

I would also be very interested in seeing some optimization to the way
draggers compute their intersections.



2015-05-06 18:49 GMT+02:00 Jaap Glas <jaap.glas at dgbes.com>:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150507/87ddcbe6/attachment-0002.htm>

More information about the osg-users mailing list