Hi J-S, On Sat, Jul 12, 2008 at 1:09 AM, Jean-Sébastien Guay <[EMAIL PROTECTED]> wrote: > I think I may be able to help a bit regarding the higher-level setup and > bookkeeping changes needed to speed things up on that regard. One thing I > noticed before is that creating a new Intersector and IntersectionVisitor > each time is costly, and instead keeping static or cached instances and > using the reset() and setStart()/setEnd() methods is faster. There may be > some other similar things that can be done too, we'll see what I can dig up.
It's interesting how different bottlenecks pop up, in this case creating objects on the heap is clearly showing itself as a bottleneck whereas the old brute force intersection code was so slow that this wasn't a significant factor. Caching visitors and intersectors can certainly help, although one does need to be careful about threading issues with doing this, as the IntersectionVisitor and Intersectors aren't thread safe, so you'd need a cached instance per thread. Optimization could possibly be done with the data structure used to store the intersection results, this would unfortunately break the API compatibility. Changing that Intersector's are cloned might also help performance when dealing with scene graphs have transform - the clone is required to move the intersector into the local coordinate system of transforms subgraph. There other things one can do like grouping intersectors, or using intersection coherency. Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

