Hi Sean,

Welcome back :-)

Transforms are relatively expensive, as the transforms need to be
tracked as well as the view frustum needing to be transformed into the
local coords below the transform for culling performance.  You two
subgraphs have 100 vs 10,000 transforms per frame, 100 won't take the
cull traversal much at all, but 10,000 will.

Second up having lots of separate osg::Geometry, even when a small
number of shared many times, requires lots of work in cull in doing
the actual cull test and more critically creating all the RenderLeaf
back end data structure required to represent the Geometry instance
with its final combination of modelview, projection and state.

So as a general rule, keep the number of transforms down, by applying
the transforms to the subgraphs and copying the geometry if required,
and keep the the number of separate geometries down by combining
smaller geometries into bigger groups.

Since you culls do look rather high even with the small scene set up,
while it's a bit of long shot, make sure that you do all your tests in
release/optimized build.

Another area you could look at at inspiration is the osgforest example
- it provides a range of implementations of forests that you can step
between, in the svn/trunk version of the OSG I've added in the
StatsHandler to show the relative costs of cull/draw and GPU.   You
run the osgforest example with a command line option to set the number
of trees for instance:

  osgforest --trees 10000

This will give you an indication of the how each of the techniques
might work in your instance.  In particular the shader path would
probably be most applicable.

Other items you could look at is the use the multi-threaded use of
osgViewer, as the DrawThreadPerContext would certainly help hide the
cost of your long cull.

Finally we have had some check-in's since OSG-2.6 include
optimizations in Matrix that reduce the overhead associated with
Transforms.  So try out the SVN/trunk or 2.7.x developer releases.

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to