Hi Jean-Charles, The OSG supports KdTrees for ray intersections with geometry in the scene, this improves performance an enormous amount. You can enable KdTree generation for loaded models with the osgDB::Options::BuildKdTreesHint or osgDB::Registry::setBuildKdTreesHint(..), or the OSG_BUILD_KDTREE=ON evn var.
If you want to assign the KdTree datastructures on models that are already loaded/created you can osg::KdTreeBuilder. Robert. On Wed, Sep 21, 2011 at 10:45 AM, Jean-Charles Quillet <[email protected]> wrote: > Hi, > > I'm working on an application that manipulates a 3d terrain (one big single > geometry). I'm using OSG for 3d rendering as well as for internal data > manipulation. I need to calculate the visibility of each point of a result > grid from a certain position P. > > I have setup the simplest algorithm for this. It goes like this > > for each point of my grid > --compute the 3D position P' on the terrain > --create a segment between P and P' > --call the intersector with the segment on the terrain > --if there is an intersection > ----flag the point as hidden > do it again > > As you can imagine, this is going fairly slow. I suppose the main issue is > that the intersector is testing every single triangle for an intersection. > Any idea to optimize this ? Thanks, > > Jean-Charles[/code] > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=42908#42908 > > > > > > _______________________________________________ > 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

