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

Jaap Glas jaap.glas at dgbes.com
Wed May 6 09:49:26 PDT 2015


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








More information about the osg-users mailing list