Re: [osg-users] Questions on optimizing my scene graph

2019-09-02 Thread Chris Djali
Hi,


> 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?


StateSet::compare takes an optional bool argument that determines whether it 
compares the contents or just pointers. By default, it's false, so just 
compares pointers, and the StateSet comparison operators leave it false, and I 
thinkl they're what actually gets used. That means you should try and use the 
same StateAttribute instances rather than copies.

You might also find that the priority for choosing which state to sort by 
doesn't necessarily reflect how expensive a particular change would be on 
modern GPUs. I don't know if there's a way of changing it, though.

Cheers,
Chris

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76633#76633





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


[osg-users] Questions on optimizing my scene graph

2019-09-02 Thread Werner Modenbach
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 -

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