[osg-users] Questions on optimizing my scene graph

Werner Modenbach Werner.Modenbach at modenbach-ac.de
Mon Sep 2 03:07:12 PDT 2019


Hi all!

I use OSG for many years now and it works really great.
Over the years the request to my application were exploding and I'm about to improve my scene graph.
In this context I have some question - maybe someone can give me some hints.

1) Statusswitches are always costly. How does OSG identify if a texture or a program is identical when
    checking for status changes? Is it by comparing the pointers? If yes, it is necessary to manage a pool
    and use the same pointers everywhere?

2) I have plenty of geometries. Groups of them work on the same vertex array, just using different index ranges.
   How should I handle this in an optimal manner?
   Should I create one geometry for such "sharing" geometries and just create many primitiveSets inside?
   How effective is culling in this case? (The primitiveSets are spread over the scene volume)
   Or should I create many geometries, each holding the relevant part of vertices with one primitiveSet each?

3) I need some LOD handling for the geometries. This means that I want to assign different shaders and
    uniforms depending on distance to camera.
    The 2 methods I can think of are
        a) using a LOD-Node, having a child for each level with the desired status settings and attach the geometry to each of them
        b) using a cullCallback changing the settings during cullTraversal
    Which is more efficient?

4) The different LOD shaders need a different number of instances of the primitiveSets.
    If I create a LOD-Node I cannot attach the same geometry to each level because the number of Instances is coded in the primitiveSet.
    Is there an elegant way to manage that?

I'm really grateful for any hints and help.

- Werner -



More information about the osg-users mailing list