Hi Viggo, The most general approach is the best, and the performance differences will almost certainly be negligible between your suggest SwitchStateSetNode and my suggest Layer node with nodemask. Feel free to implement both and test them against each other w.r.t cull traversal time and overall framerate.
Robert. On Thu, Nov 20, 2008 at 10:17 AM, Viggo Løvli <[EMAIL PROTECTED]> wrote: > Hi Robert, > >> By default I would expect it to traverse all children. One variation >> I considered was to have a NodeMask + StateSet per Child, with this >> combination you'd be able to select different combinations for >> different traversal masks. >> > > If I set up the LayerNode to have one child for each StateSet I want to > switch between, and give each of those children their own node mask. Then I > can set up the cull-mask of my cameras so that they chose the correct > StateSet. This will work fine. > The LayerNode will be more flexible than the StateSetSwitchNode, but I think > it will be a bit slower. > > > Let's examine traverse performance of the LayerNode and the > StateSetSwitchNode. > In this example we assume that we want to switch between 5 different > state-sets. > I am now only looking at the usage method that the StateSetSwitchNode > supports. > > LayerNode: > ============ > Cull-traverse will first run the accept function of the LayerNode. It will > then call traverse and call accept for each of the 5 children of the > LayerNode. One of the 5 children will pass the mask check and call its > traverse function. > > LayerNode will be slower the more StateSet's you want to switch between. > > Any traverse with node mask 0xffffffff will traverse each of the 5 children, > and their children > In my case, they share the same children, which can be a whole world. > > StateSetSwitchNode: > ===================== > Cull-traverse will call the accept function of the StateSetSwitchNode. This > function is modified and has one extra bitvise and operation, and one extra > array lookup. It then call the traverse function of the node-pointer it read > from the array. > That sounds like almost 5 times faster than the LayerNode. > > StateSetSwitchNode will not run slower if we add more StateSet's to switch > between. > > Any traverse with node mask 0xffffffff will traverse only one of the nodes > in the array and that node's children. All nodes in the array share the same > children, and in this solution they get traversed one time instead of 5. > > > I feel that I need to state that the StateSetSwitchNode comes with a > rule-set: > - Only one of the state-sets shall be traversed during any traversal. > - They shall all point to the same sub-tree (always). > These rules are neccessary in order to make the cull-traverse as fast as > possible. > > > My conclusion after this e-mail is still that I want to implement the > StateSetSwitchNode as an addition to the SwitchNode and a future version of > the LayerNode. > It would be very beneficial for me to integrate it to OSG and support it in > the .ive and .osg file formats. > I would be happy to contribute a good example of usage and the OSG > implementation if you give a green light to OSG integration. > > Viggo > > > ________________________________ > Få Hotmail du også. Windows Live Hotmail med 5000 MB gratis lagringsplass. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

