HI Christian,

On 6 March 2012 11:07, Christian Buchner <[email protected]> wrote:
> I found that an osg::Switch object will still have all its children
> run through the cull traversal. So we migrated away from osg::Switch
> to conditionally display thousands of child nodes.

A rather curious statement.

If a switch node switches off a child it won't traverse it in the
update and cull traversals. It does however have to test each child to
see if it's switched off or not, which is an O(n) operator where n is
the number of children of the switch.

If you just want to switch on one child out of thosuands then
osg::Switch will be relatively expensive.  For this type of switch a
custom node would be best, osg::Switch is designed primarily for
flexibility rather than serving a niche task of optimizing for massive
switching between thousands of children.

> Node masks could be a better solution for what you are trying to
> achieve. This will at least get rid of the bad cull performance.

Using NodeMask will be worse for performance as the osg::Switch
testing will be done prior to checking the child itself so less memory
will need to be checked and less virtual functions needed to be
called.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to