[osg-users] Best practice for dynamic StateSets & Geometry

Robert Osfield robert.osfield at gmail.com
Wed Apr 15 06:20:01 PDT 2015

Hi Jannik,

On 15 April 2015 at 11:55, Jannik Heller <scrawl at baseoftrash.de> wrote:

> Thanks for the hints - I am using a release build, and I already disabled
> double precision from cmake which gave me another nice boost.

I am surprised you saw a boost with disable double precision.  What
specific element you do you change w.r.t double precision?

For the change to double precision making a difference it's a hint that you
have a scene that is poorly balanced.

> In the stats handler I am seeing roughly the same amount of time spent in
> the cull, draw and GPU threads. After adding the double buffering the 3
> threads all run in parallel so performance is decent now.
> I know that my app is CPU bound but there's not much I can do about it.
> Some of the time in the cull thread is spent updating vertex animations,
> and some time for organizing light lists. I have scenes with a lot more
> than 8 lights, so I have to check what lights are closest to a given
> sub-graph before rendering it. This system was really slow to begin with
> but I already optimized it a lot. Non the less setting the lights still has
> a noticable overhead.
> Next problem is the sheer number of objects - often thousands per scene. I
> tried batching before but the problem is the scenes I am working with are
> scripted, so objects can be moved or removed at any time, also, batching
> objects would interfere with the light lists - i.e. with too many objects
> sharing a large batch I can not set fine grained light lists on them.
> I'm looking forward to switching the light system to deferred shading in
> the future - I'm sure then it will be GPU bound. I still need a forward
> rendering fallback in place though.

Thousands of objects per frame is not unusually for a scene graph
application and should work fine rendering at 60hz on modern hardware.  If
you are hitting CPU limits prematurely then it's another hint that the
scene graph is poorly balanced.

There are lots of different things you can do to create a more efficient
scene graph, exactly what to advice is hard to do without knowing more
specifics about the application and types of data being handling.  Batching
might be one thing to try, but only if it's established as the main
bottleneck.  From what you've written I wonder if the animation element to
your scene is what is slowing things down.   Are you using CPU based
animation?  Could you shift it onto the GPU?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150415/8dc20ed8/attachment-0003.htm>

More information about the osg-users mailing list