[osg-users] problem with picking/intersecting in window space

Andreas Mueller andiadb at gmx.de
Sat Jun 9 04:19:02 PDT 2018


Hi,

I have a problem with picking via an intersector in window space.
For picking I use the following code:


Code:
osgUtil::LineSegmentIntersector* pIntersector = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y);
pIntersector->setIntersectionLimit(osgUtil::Intersector::LIMIT_NEAREST);
osgUtil::IntersectionVisitor iv(pIntersector);
camera->accept(iv);



If I zoom in then it happens that I can not pick elements just in front of me near the eye position.
It seems that some (near plane) clipping/culling happens in the intersector while the rendering uses another near plane for clipping.
The camera uses the default COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES mode.

For testing purposes, I set in the camera the DO_NOT_COMPUTE_NEAR_FAR mode. Then I noticed near plane clipping when zooming in (that I don't have in COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES mode) but I can pick all elements that are rendered.

So I guess the intersector don't use the automatically computed near/far clipping planes of the camera (if in COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES mode) for the conversion of the intersector line segment coordinates from window to world space where the intersection is actually done. 
Is this correct? And what do I have to do to be able to pick all elements that are rendered with the COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES mode?

Thank you!

Regards,
Andreas

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74017#74017







More information about the osg-users mailing list