[osg-users] View Frustrum Culling

Kaiser, Hagen (CT) hagen.kaiser at siemens.com
Tue Jul 29 08:22:54 PDT 2008

Hi Viggo,
Thx for your reply. I have made some progress (I thought).
With you soultion and the render-bin I think I can get all the
But basically I want to get the nodes I stuffed with osgDB::redNode()
somewhere else.

I thought that its best to use a visitor, because I need this operation
only once and not every frame.
There is a function inside the CullVisitor that is named 
bool isCulled(Node);
So I tried to derive a cullvisitor and let him get me all Nodes that are
not Culled;
But this visitor must probably be set up in special way I don't know.
The CullingSet which is associated in the CullVisitor, is the class that
realizes the isCulled-Function; But this CullingSet is NullPtr and I
don't see a way in the interface to set this CullingSet  manually.

Tomorrow I will have my try with an CullCallback like its said in the
Or maybe I derive just the special nodes Im interested in whith your
solution and the isCulled-Function. That should be the best way I think.
Ill let you know.

Thx again and greetings
	(Kaiser is my families name :-))

Hi Kaiser,
I have just done parts of what you need.
Make yourself a group node which you place as the root of the
scene-graph that you need to list objects from.
Override it's traverse function and post process the cull-visitor:
void yourGroupClass::traverse( osg::NodeVisitor& nv )
    osg::Group::traverse( nv );
    if( nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR )
        osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(
&nv );
        if( cv )
            // Do your stuff here
            // You should be able to find what you need inside
            // The cull-traverse is done, so everything that is visible
must be stored in the render-bins.
            // I am pretty sure you should be able to find some
information in these structures which points you to your objects.

Date: Tue, 29 Jul 2008 09:56:59 +0200From: hagen.kaiser at siemens.comTo:
osg-users at lists.openscenegraph.orgSubject: [osg-users] View Frustrum

Hello everyone, 
Maybe it sounds basic. I have camera that will never change place. I
have a database with one Object/onFile-Mapping. So next time I load my
Scene id like to load only relevant Objects to shorten Loading time.
Simple Task: I need to get a list of all VISIBLE Objects in the
ViewFrustrum. Can this be done with the cull-Traverser. The docs say it
collects all the objects in a special order. Are these objects all
objects in the end or only the visible? How can I get the visbile Nodes?
What things are to be taken care of? 

More information about the osg-users mailing list