Hello Karl,

This is very, very fast, <1sec for 1.000 cows.
But some nodes could be outside the selectionBoundingBox, because the box of 
the node has an intersection with the SelectionBoundingBox and not the node 
itself.

Yes, that's a classic optimization. I haven't looked at the code (that's the next step) but PolytopeIntersector probably has a broad-phase and narrow-phase, where broad-phase tests only bounding volumes to get a "potential intersecting set" and then narrow-phase tests the actual geometry against the polytope. The broad-phase would use the hierarchy as well since the scene graph has bounding spheres at the node level and bounding boxes at the drawable level, so you can eliminate non-intersecting branches of the graph quickly. It's the narrow-phase that takes a long time.

I'm not sure if it's done that way, but a potential optimization here would be to specify to the intersector whether you want a test-intersection or a find-intersection (the former is just interested in whether something intersects, not necessarily what - useful for shadow tests in raytracing; the latter finds everything that intersects and is therefore longer to compute), and whether you're interested in individual polygons, drawables or nodes.

My hypothesis is that the PolytopeIntersector wants to return all the actual polygons which were inside/intersecting the polytope, but in our case, we just want to know which nodes should be selected. So in that case, as soon as the intersector finds a single polygon in a node that intersects, it accepts the node and skips to the next one. I think that would speed up our situation greatly.

Anyways, as I said I'll start investigating this in practice soon, for now it's just theory. If you want to dive into the code of the PolytopeIntersector and see what you can find out, feel free, and report your findings here please :-)

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to