Hello,
I have tried to make use of the occlusion culling support of OpenSG. For that I have changed my code as described by http://www.opensg.org/wiki/DevGuide/OcclusionCulling#OcclusionCulling i.e. added the following lines to my render call: void CompositeViewer::redraw() { if (!_win) return; if (!_action) _action = RenderAction::create(); // Don't draw or test any object taking up less than 15 pixels _action->setOcclusionCullingMinimumFeatureSize(15); // Any object with an 80% or better chance of being covered, test instead of draw _action->setOcclusionCullingCoveredThreshold(0.8); // If the test comes back with less than 15 pixels that would have changed // then discard this geometry and don't draw it _action->setOcclusionCullingVisibilityThreshold(15); // Use a query buffer that can hold 600 tests at a time _action->setOcclusionCullingQueryBufferSize(600); // Objects with less than 50 triangles, just draw and don't test _action->setOcclusionCullingMinimumTriangleCount(50); // Turn Occlusion Culling on _action->setOcclusionCulling(true); BOOST_FOREACH(ViewT& view, _views) { assert(view->getSceneManager()); if (!view->getSceneManager()->getInternalRoot()) { view->showAll(); } UInt32 trav_mask = view->getPort()->getTravMask(); view->getPort()->setTravMask(trav_mask & ~NON_VISIBLE); if (view->getNavigatorOn() && view->getNavigator()) view->getNavigator()->updateCameraTransformation(); view->getSceneManager()->updateHighlight(); view->getSceneManager()->updateSilhouetteShader(view->getSize()); view->getSceneManager()->updateShadows(); } Thread::getCurrentChangeList()->fillStatistic(_action->getStatCollector( )); Thread::getCurrentChangeList()->commitChanges(); _win->render(_action); } After loading an existing model I got the following crash: OSGSystemD.dll!OSG::DrawableStatsAttachmentBase::getValid() Line 241 + 0x11 bytes C++ OSGSystemD.dll!OSG::DrawableStatsAttachment::validate() Line 193 + 0xd bytes C++ OSGSystemD.dll!OSG::OcclusionCullingTreeBuilder::testNode(OSG::OCRenderT reeNode * pNode=0x00000000145ae8c0, OSG::DrawEnv & denv={...}, OSG::RenderPartitionBase * part=0x000000000da12000, float & scr_percent=0.010344837) Line 518 C++ OSGSystemD.dll!OSG::OcclusionCullingTreeBuilder::testNode(OSG::OCRenderT reeNode * pNode=0x000000001bf961c0, OSG::DrawEnv & denv={...}, OSG::RenderPartitionBase * part=0x000000000da12000, float & scr_percent=0.010344837) Line 575 C++ OSGSystemD.dll!OSG::OcclusionCullingTreeBuilder::testNode(OSG::OCRenderT reeNode * pNode=0x000000001bf960e0, OSG::DrawEnv & denv={...}, OSG::RenderPartitionBase * part=0x000000000da12000, float & scr_percent=0.010344837) Line 575 C++ OSGSystemD.dll!OSG::OcclusionCullingTreeBuilder::draw(OSG::DrawEnv & denv={...}, OSG::RenderPartitionBase * part=0x000000000da12000) Line 375 C++ OSGSystemD.dll!OSG::RenderPartition::doExecution(bool bRestoreViewport=true) Line 1203 C++ OSGSystemD.dll!OSG::RenderAction::drawBuffer(unsigned int buf=0) Line 618 C++ OSGSystemD.dll!OSG::RenderAction::stop(OSG::ActionBase::ResultE res=Continue) Line 422 C++ OSGSystemD.dll!OSG::Action::callStop(OSG::ActionBase::ResultE res=Continue) Line 623 + 0x14 bytes C++ OSGSystemD.dll!OSG::Action::apply(std::_Vector_iterator<OSG::Node *,std::allocator<OSG::Node *> > * begin=0x000000001e4662c0 {_values=[8055](0x000000000cf54000 {_vChunks=[0]() _pShader=0x0000000000000000 _pShaderVar=0x0000000000000000 ...},0x000000000cf57a20 {_vChunks=[1]((29,0x000000000e570600)) _pShader=0x0000000000000000 _pShaderVar=0x0000000000000000 ...},0x000000000cf57930 {_vChunks=[2]((29,0x000000000e570600),(30,0x000000000df82280)) _pShader=0x0000000000000000 _pShaderVar=0x0000000000000000 . , std::_Vector_iterator<OSG::Node *,std::allocator<OSG::Node *> > * end=0x000000001e4662c0 {_values=[8055](0x000000000cf54000 {_vChunks=[0]() _pShader=0x0000000000000000 _pShaderVar=0x0000000000000000 ...},0x000000000cf57a20 {_vChunks=[1]((29,0x000000000e570600)) _pShader=0x0000000000000000 _pShaderVar=0x0000000000000000 ...},0x000000000cf57930 {_vChunks=[2]((29,0x000000000e570600),(30,0x000000000df82280)) _pShader=0x0000000000000000 _pShaderVar=0x0000000000000000 . ) Line 273 + 0xe bytes C++ OSGSystemD.dll!OSG::Action::apply(OSG::Node * const node=0x000000000b1f6a00) Line 290 + 0x87 bytes C++ OSGSystemD.dll!OSG::Viewport::render(OSG::RenderActionBase * action=0x000000000da2a900) Line 362 C++ OSGWindowD.dll!OSG::PassiveViewport::render(OSG::RenderActionBase * action=0x000000000da2a900) Line 170 C++ OSGSystemD.dll!OSG::Window::doRenderAllViewports(OSG::RenderActionBase * action=0x000000000da2a900) Line 2392 C++ OSGSystemD.dll!OSG::Window::render(OSG::RenderActionBase * action=0x000000000da2a900) Line 1997 C++ RenderEngineD.dll!RenderEngine::graphic::CompositeViewer::redraw() Line 405 C++ The DrawableStatsAttachment *st = DrawableStatsAttachment::get(pNode->getNode()->getCore()); is NULL which causes the crash. Do I have to take any other measures beside of the above changes to my code? Is the occlusion culling still in use and supported? Is it advisable to use occlusion culling in modern GPU/shader etc. setups? Any idea what goes wrong and causes the crash? In my setup I use GL_TRIANGLES_ADJACENCY_EXT and GL_TRIANGLE_STRIP_ADJACENCY_EXT GL primitives for my meshes. Can this be problematic for the occlusion culling implementation? Any help is appreciated. Best, Johannes ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users