[osg-users] Disabling small feature culling for a subgraph

Per Fahlberg perfa at remograph.com
Mon Mar 2 12:01:30 PST 2009


Hi Robert,

Ok, so if I change the mask of the current CullingSet in a cull 
callback, should it only affect the culling of the node that the 
callback is attached to and not the nodes below in the scenegraph?

If I change the culling mode of the cull visitor in a cull callback, 
should it affect all nodes traversed after the node with the callback? 
This was what I thought, but it didn't work for disabling or enabling 
small feature culling at least. From my debugging it seams like changing 
the culling mode of the cullvisitor during traversal doesn't have any 
affect on culling, i.e. it doesn't change the mask of any culling sets 
used after the culling mode is changed. I tried to fix this with the 
patch earlier that you rejected.

Is there any other way to change the culling mode from a cull callback 
so that it affects the culling of nodes below the node with the cull 
callback?

Regrads,
Per

Robert Osfield wrote:
> Hi Per,
>
> I'm a bit rusty on this topic, too many topics coming flying by each
> day that niche stuff drops out of focus quite quickly...
>
> Something I can answer right away is to to explain the relationship
> between the CullingSet CullingMode and CullingMask.  The Mode is the
> base mode that specifies what the overall mode should be, while the
> CullingMask is the current active subset of this mode, that handles
> the fact that different faces of the view frustum get disabled when
> subgraphs are completely inside the faces of the view frustum.   At
> least that what I can recall/work out from a brief look through the
> code.
>
> Robert.
>
> On Fri, Feb 27, 2009 at 9:16 PM, Per Fahlberg <perfa at remograph.com> wrote:
>   
>> A correction, my earlier proposed fix also solves this problem if the cull
>> callback is changed to also modify the culling mode of the cull visitor, so
>> that the callback reads something like this:
>> ...
>> osg::CullSettings::CullingMode cullVisitorCullingMode =
>> cv->getCullingMode();
>> osg::CullingSet &cs = cv->getCurrentCullingSet();
>> osg::CullingSet::Mask cullingSetMask = cs.getCullingMask();
>>
>> cv->setCullingMode(cullVisitorCullingMode |
>> osg::CullSettings::SMALL_FEATURE_CULLING);
>> cs.setCullingMask(cullingSetMask |
>> osg::CullSettings::SMALL_FEATURE_CULLING);
>>
>> traverse(node,nv);
>>
>> cs.setCullingMask(cullingSetMask);
>> cv->setCullingMode(cullVisitorCullingMode);
>> ...
>>
>> I'm a bit confused about all the culling masks/modes and which ones to
>> modify and how they are propagated when the cull visitor traverses the
>> scenegraph.
>>
>> Regards,
>> Per
>>
>> Per Fahlberg wrote:
>>     
>>> Hi Robert,
>>>
>>> I've been busy with other work and only now been able to try your proposed
>>> change and found that it doesn't quite work as expected. When I run the
>>> attached modified osgscribe example with the attached box-sphere.osg model
>>> the small feature culling only culls the entire model, i.e. both the box and
>>> the sphere together not separately as I was expecting. If small feature
>>> culling is turned on on the camera the box and sphere is culled by the small
>>> feature culling individually. I would like to enable small feature culling
>>> on quite large subgraphs and it seams that it only turns on small feature
>>> culling on the node with the callback not on the nodes bellow it. This feels
>>> very similar to the problem I was originally trying to solve, where the
>>> disabling of small feature culling wasn't propagated downwards but the fix I
>>> submitted then didn't fix this problem. Do I need to add the callback to all
>>> nodes that I wish to be culled by small feature culling or is this a problem
>>> in osg?
>>>
>>> Regards,
>>> Per
>>>
>>> Robert Osfield wrote:
>>>       
>>>> Hi Per,
>>>>
>>>> On Wed, Jan 28, 2009 at 8:55 PM, Per Fahlberg <perfa at remograph.com>
>>>> wrote:
>>>>
>>>>         
>>>>> I don't really understand how this is not a bug since it is possible to
>>>>> switch small feature culling on for a subgraph but not switch it off?
>>>>>
>>>>>           
>>>> The scene graph itself doesn't support switching off small feature
>>>> culling in a subgraph. The way you tried to add this back in was
>>>> inappropriate, so didn't work.
>>>>
>>>> My proposed change to just enable small feature culling for subgraphs
>>>> that needn't it didn't require disabling culling for subgraphs so
>>>> would be more efficient as culling would never be complete disabled.
>>>> Disabling culling for a deeply embedded subgraph causes all the
>>>> parents culling to be disabled as well, which prevents early
>>>> termination of traversal that would otherwise be done so I wouldn't
>>>> recommend it.
>>>>
>>>>
>>>>         
>>>>> I will however scratch my head and try to figure out if I can somehow
>>>>> easily
>>>>> invert the enabling and disabling of small feature culling in my
>>>>> program.
>>>>>
>>>>>           
>>>> You could just use LOD's, this is effectively all that small feature
>>>> culling simulates.
>>>>
>>>> Alternatively you could just set the bounding box of the drawables of
>>>> interest to an artificially large size to prevent the small feature
>>>> culling from effecting them.
>>>>
>>>> Robert.
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> osg-users at lists.openscenegraph.org
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>>
>>>>         
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>       
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>     
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>   




More information about the osg-users mailing list