Can't you attach user data element to your Geodes or Geometry objects that
roughly correspond to render bins or rendering order? Then in the
intersection code, get a list of all hits, and sort it by render order
first, followed by depth. This of course means that you have to pretty
tightly control the render order yourself.

If you want to incorporate the Z buffer results in your intersection tests,
you need to render to an FBO with a Z buffer that is also readable as a
texture. That allows you to extract the depth of each screen pixel and
convert it to a linear distance from camera (or even a world space
coordinate).  Using this knowledge you can ignore intersection hits that
are not anywhere close to the coordinate reported by the intersection
visitor.

Christian


2015-03-03 10:24 GMT+01:00 Robert Osfield <[email protected]>:

> Hi John-Luke,
>
> The osgUtil::IntersectionVisitor/LineSegmentIntersector is based of pure
> geometry calculations, there isn't any reference to rendering elements so
> has no knowledge of what may or may not have been rendered.
>
> If you want to have picking based on rendering results you'll need to
> implement your own scheme based on OpenGL rendering of the scene.  There
> are a range of ways to tackle it's quite a bit more complicated than just
> using the OSG's standard intersection classes.
>
> Robert.
>
> On 2 March 2015 at 21:46, John-Luke Laue <[email protected]> wrote:
>
>> Hi all,
>>
>> Hopefully this isn't too newbie a question.
>>
>> Let's say I have a camera at the origin, looking down +x axis.
>> I have a cube at position (1,0,0) and a sphere at position (5,0,0).
>>
>> If I render my scene normally, I will see (from the camera) the cube, but
>> not the sphere because it is occluded by the cube. When I use the osg
>> picker to pick with my mouse, it will pick the cube first, then the sphere.
>>
>> Next, I disable depth testing and give the sphere a higher render order
>> than the cube. When I render my scene again, now I see the sphere and not
>> the cube.
>> However, if I use my picker again, the picker still picks the cube first,
>> and then the sphere.  I want the opposite.
>>
>> Which leads me to my question: Can the osg picker order the picking based
>> on render order or is it always by depth only?
>>
>> Thank you for your time!
>>
>> Cheers,
>> John-Luke
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=62916#62916
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to