Hi Andrew,

I guess that the nodes you have disabled small feature culling on is deep in the scene graph and I suspect that a node higher up in the scene graph is getting culled by small feature culling. I know of two ways to get around that problem. One is to disable culling on the node you have set the callback on, i.e. setCullingActive(false), this will make sure that the cullvisitor will always visit your node. This might of course cause a performance penalty if the scene graph is big and deep. The second approach is to reverse the situation, instead of disabling small feature culling for specific nodes you disable it globally (i.e. do not turn small feature culling on) and then you enable it for the subgraphs that needs it. I wound up doing the later since it was pretty straight forward for my scene graph and it felt like the best way to do it.

Regards
/Per

Andrew Burnett-Thompson wrote:
Hi Per,

Great example, thanks for taking the time to post this.

Ok I created a class SmallFeatureCullExcluder (inherits NodeCallBack) and added the code you put in the () operator. I also changed the mask to

cullingSet.setCullingMask(cullingSetMask & ~osg::CullSettings::SMALL_FEATURE_CULLING);

Then I added this as a cull-callback on the Geode I want to exclude. I'm afraid to say it didn't work, it still gets small feature culled.

Also I tried adding it on the parent (PositionAttitudeTransform) and as an UpdateCallBack instead of CullCallBack, still no luck.

The code is being reached (I set a breakpoint) but when you zoom out enough the object gets small-feature culled and the code is not reached.

Any ideas what I may be doing wrong?

Thank you,
Andrew

On Tue, Sep 8, 2009 at 8:07 PM, Per Fahlberg <[email protected] <mailto:[email protected]>> wrote:

    Hi Andrew,

    I was trying to accomplish exactly the same and finally found a
    solution, if you search the mailing list for "Disabling small
    feature culling for a subgraph" you will find the email thread
    when I discussed this with Robert. I've pasted the final solution
    below for your convinienc.

    Regards
    /Per

    Hi,

    For the record I've found a way to get things working the way I
    want it, by changing the culling mask of the culling set at the
    back of the projection culling stack, small feature culling can
    now be both enabled and disabled for subgraphs. The code for my
    callback looks like this now (the code is for enabling small
    feature culling, change the "|" to "& ~" to disable small feature
    culling):

    virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
    {
     osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
     if(cv){
       osg::CullStack::CullingStack &projCullStack =
    cv->getProjectionCullingStack();
       if(!projCullStack.empty()){
         osg::CullingSet& cullingSet = projCullStack.back();
         osg::CullingSet::Mask cullingSetMask =
    cullingSet.getCullingMask();
         cullingSet.setCullingMask(cullingSetMask |
    osg::CullSettings::SMALL_FEATURE_CULLING);

         traverse(node,nv);
               cullingSet.setCullingMask(cullingSetMask);
       }else
         // Do not really now what to do if it is empty
         traverse(node,nv);
     }else
       traverse(node,nv);

    }

    Andrew Thompson wrote:

        Hi there, and thanks for your response,
        well I am using small feature culling in my application to
        improve performance. Its a CAD-style app and I have hundreds
        of thousands of Geodes on the screen at any one time. Many are
        really small so I am throttling small-feature culling to
        maintain a decent framerate when moving around. When static
        the scene re-draws everything.
        But - there are certain objects, markers around the scene, I'd
        like to exclude from the small feature cull if possible.
        If its not possible, no matter, just was hoping there was a
        simple solution to this.
        Thank you, Andrew

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





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


    _______________________________________________
    osg-users mailing list
    [email protected]
    <mailto:[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

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

Reply via email to