Hello Peter,

> I'm trying to dig into the reasons that OSG
intersections might be slower, and one of the first things that I noticed was the fact that our in-house library uses only hierarchical AABBs at all levels, whereas OSG uses mostly bounding spheres until getting down to the drawable level.

Theoretically, using bounding spheres until you get to the drawable level and AABBs for drawables should be *faster* than using AABBs at all levels. At least as far as testing the hierarchy to get a potential intersection set. Depending on your hierarchy of course, but for terrain I assume you're using a quad-tree of LODs right? So IMHO, the difference is probably in the geometry testing speed.

Have you switched on building of kdtree data structures for your geometry? Try doing this at application start-up (before loading anything):

    osgDB::Registry::instance()->setBuildKdTreesHint(
        osgDB::ReaderWriter::Options::BUILD_KDTREES);

If you don't do this, the hint is set to osgDB::ReaderWriter::Options::NO_PREFERENCE, which won't build kdtrees by default. Using kdtrees is orders of magnitude faster than not when testing geometry for intersections, so this will probably help.

(I'm also assuming you're using IntersectionVisitor and not IntersectVisitor which is deprecated and won't use the kdtrees even if they're there...)

If that doesn't help, then you'll probably have to go in and do some profiling. There are many tools that can help. I've used AQTime on Windows before, and loved it.

Hope this helps,

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

Reply via email to