Hi Sean,
Yes this makes sense. There is a mechanism in Drawable that allows
you to define an inital bound that is used in the compute of the
geometry position, this was done quite a few years ago at begining of
the journey in the land of vertex shader. These days I think a better
solution would be to just allow users to manually define it and
disable the automatic compute of the bounding volume.
So try using
geometry->setInitialBound(bb);
Where bb is the max size you expect the goemetry to get to/or the
bound that you used for the KdTree.
If that works OK I can look at cleaning up the overriding of the computed bound.
Robert.
On Thu, Dec 4, 2008 at 6:30 PM, Sean Spicer <[EMAIL PROTECTED]> wrote:
> Robert,
>
> I think I know why things go bad in KDTree,
>
> I'm using KDTree to "spoof" the location of some actual geometry, which is
> transformed in a vertex/geometry shader.
>
> So, I compute a bounding box for where the geometry ought to be, and create
> a dummy geometry from that - I then compute the KDTree for this dummy
> geometry, and assign it to the actual geometry that will be sent down the
> pipe, which is at the scene origin, not its final location.
>
> When the line-segment intersector goes to pick, it first checks to see if
> the line segment intersects the bounding box of the drawable, which as far
> as I can tell is computed against the actual geometry (in this case the
> geometry at the origin) and not the KDTree's bounding box. When it doesn't
> properly intersect, the line-segment intersector returns without hitting the
> KDTree.
>
> I think what is needed is to test against the KDTree bounding box, rather
> than the geometry bounding box, if a KDTree is assigned.
>
> Does this make any sense?
>
> sean
>
> On Wed, Dec 3, 2008 at 10:05 AM, Sean Spicer <[EMAIL PROTECTED]> wrote:
>>
>> Robert,
>>
>> I will see if I can repro the problem with osgpick and send you the osg
>> file. It may take me a week or two though as I've got a lot on my plate ;-)
>>
>> cheers,
>>
>> sean
>>
>> On Wed, Dec 3, 2008 at 3:28 AM, Robert Osfield <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi Sean,
>>>
>>> This sounds like a bug, but without a dataset and example that
>>> reproduces the problem it's next to impossible to home in on a fix.
>>> Would it be possible for you to provide a problem dataset that
>>> illustrates the problem? If it can be reproduced with one of the
>>> existing examples like osgpick then this will make it easier to track
>>> down.
>>>
>>> Robert.
>>>
>>> On Wed, Dec 3, 2008 at 12:00 AM, Sean Spicer <[EMAIL PROTECTED]>
>>> wrote:
>>> > Hi Gang,
>>> >
>>> > I'm working on improving picking performance via KDTree, but I'm
>>> > hitting an
>>> > issue that is driving me nuts: If I pick a node from directly above
>>> > (e.g. +
>>> > Z axis) everything works great, and picking is *very* fast. If I pick
>>> > at an
>>> > angle, (e.g. from eye(1,1,1)) then picking is fast, but not accurate -
>>> > nodes
>>> > to the left, right, top, or bottom get picked instead of what I'm
>>> > after.
>>> >
>>> > Here is my KDTree Build function:
>>> >
>>> > #ifdef USE_KDTREE
>>> >
>>> > // Update the KDTree
>>> > osg::KdTree::BuildOptions kdTreeBuildOptions;
>>> > osg::ref_ptr<osg::KdTree> kdTree = new osg::KdTree();
>>> >
>>> > if(kdTree->build(kdTreeBuildOptions, geometry))
>>> > {
>>> > geometry->setShape(kdTree.get());
>>> > }
>>> > else
>>> > {
>>> > LOG_MSG(logERROR) << "osg::KdTree::build() unsuccessful.";
>>> > }
>>> > #endif
>>> >
>>> > Any suggestions?
>>> >
>>> > cheers,
>>> >
>>> > sean
>>> >
>>> > _______________________________________________
>>> > 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
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org