gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.52k stars 782 forks source link

GPU clamping with occlusion culling crash #336

Closed remoe closed 11 years ago

remoe commented 11 years ago

I have a crash with the current HEAD from today when I use the following in my earthfile:

icon: "http://localhost/x.png";
icon-placement:  vertex;
icon-scale: 1.0;
icon-occlusion-cull: true;
icon-occlusion-cull-altitude: 8000;
altitude-offset: 100;
altitude-clamping: terrain-gpu;

but it doesn't crash when i use:

icon: "http://localhost/x.png";
icon-placement:  vertex;
icon-scale: 1.0;
icon-occlusion-cull: true;
icon-occlusion-cull-altitude: 8000;
altitude-clamping: terrain;
altitude-resolution: 0.01;

Here is the callstack:

It crashes because of empty( NULL) of _modelviewStack in CullStack.

>   osg93-osgd.dll!osg::Matrixd::operator()(int row, int col)  Line 54 + 0x1a bytes C++
    osg93-osgd.dll!osg::CullStack::getUpLocal()  Line 154 + 0xc bytes   C++
    osg93-osgd.dll!osg::AutoTransform::accept(osg::NodeVisitor & nv)  Line 194 + 0xc bytes  C++
    osg93-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv)  Line 62 + 0x25 bytes    C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osgEarthd.dll!osgEarth::ProxyCullVisitor::handle_cull_callbacks_and_traverse(osg::Node & node)  Line 807 + 0xf bytes    C++
    osgEarthd.dll!osgEarth::ProxyCullVisitor::apply(osg::Transform & node)  Line 860    C++
...
    osgEarthd.dll!`anonymous namespace'::OverlayProxy::traverse(osg::NodeVisitor & nv)  Line 98 + 0xf bytes C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osgEarthd.dll!osgEarth::ProxyCullVisitor::handle_cull_callbacks_and_traverse(osg::Node & node)  Line 807 + 0xf bytes    C++
    osgEarthd.dll!osgEarth::ProxyCullVisitor::apply(osg::Node & node)  Line 824 C++
...
    osgEarthd.dll!osgEarth::ClampingTechnique::cullOverlayGroup(osgEarth::OverlayDecorator::TechRTTParams & params, osgUtil::CullVisitor * cv)  Line 531 + 0x22 bytes   C++
    osgEarthd.dll!osgEarth::OverlayDecorator::traverse(osg::NodeVisitor & nv)  Line 679 + 0x33 bytes    C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node & node)  Line 313 + 0xf bytes C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Group & node)  Line 1220    C++
    osg93-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv)  Line 38 + 0x41 bytes  C++
    osg93-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv)  Line 62 + 0x25 bytes    C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node & node)  Line 313 + 0xf bytes C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Group & node)  Line 1220    C++
    osg93-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv)  Line 38 + 0x41 bytes  C++
    osgEarthd.dll!osg::NodeAcceptOp::operator()(osg::ref_ptr<osg::Node> node)  Line 358 + 0x5e bytes    C++
    osgEarthd.dll!std::_For_each<osg::ref_ptr<osg::Node> *,osg::NodeAcceptOp>(osg::ref_ptr<osg::Node> * _First, osg::ref_ptr<osg::Node> * _Last, osg::NodeAcceptOp _Func)  Line 22 + 0x1a bytes C++
    osgEarthd.dll!std::for_each<std::_Vector_iterator<std::_Vector_val<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node> > > >,osg::NodeAcceptOp>(std::_Vector_iterator<std::_Vector_val<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node> > > > _First, std::_Vector_iterator<std::_Vector_val<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node> > > > _Last, osg::NodeAcceptOp _Func)  Line 32 + 0x5e bytes    C++
    osgEarthd.dll!osgEarth::MapNode::traverse(osg::NodeVisitor & nv)  Line 718 + 0x72 bytes C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node & node)  Line 313 + 0xf bytes C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Group & node)  Line 1220    C++
    osg93-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv)  Line 38 + 0x41 bytes  C++
    osg93-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv)  Line 62 + 0x25 bytes    C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::handle_cull_callbacks_and_traverse(osg::Node & node)  Line 313 + 0xf bytes C++
    osg93-osgUtild.dll!osgUtil::CullVisitor::apply(osg::Group & node)  Line 1220    C++
    osg93-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv)  Line 38 + 0x41 bytes  C++
    osg93-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv)  Line 62 + 0x25 bytes    C++
    osg93-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node)  Line 193 + 0x1c bytes  C++
    osg93-osgUtild.dll!osgUtil::SceneView::cullStage(const osg::Matrixd & projection, const osg::Matrixd & modelview, osgUtil::CullVisitor * cullVisitor, osgUtil::StateGraph * rendergraph, osgUtil::RenderStage * renderStage, osg::Viewport * viewport)  Line 980 + 0x1a bytes   C++
    osg93-osgUtild.dll!osgUtil::SceneView::cull()  Line 845 + 0x57 bytes    C++
    osg93-osgViewerd.dll!osgViewer::Renderer::cull()  Line 615 + 0xf bytes  C++
    osg93-osgViewerd.dll!osgViewer::ViewerBase::renderingTraversals()  Line 804 + 0x15 bytes    C++
    osg93-osgViewerd.dll!osgViewer::ViewerBase::frame(double simulationTime)  Line 656 + 0xf bytes  C++

One earth file sample:


<map name="Model Demo" type="geocentric" version="2">

    <options>
        <elevation_tile_size>15</elevation_tile_size>
        <terrain lighting="false" first_lod="1"/>
        <osg_file_paths>
            <url>../data</url>
        </osg_file_paths>
    </options> 

    <image name="readymap_imagery" driver="tms" visible="true">
        <url>http://readymap.org/readymap/tiles/1.0.0/7/</url>
    </image>

    <elevation name="readymap_elevation" driver="tms">
        <url>http://readymap.org/readymap/tiles/1.0.0/9/</url>
    </elevation>

    <model name="points" driver="feature_geom">
        <features name="points" driver="tfs">
            <url>../data/points/tfs.xml</url>
            <format>json</format>
             <build_spatial_index>true</build_spatial_index>
        </features>

        <styles>
            <style type="text/css">
                points {
                    icon:   "../data/placemark64.png";                   
                    icon-occlusion-cull: true;
                    altitude-clamping:   terrain;
                    altitude-offset:     500;
                    icon-placement: vertex;                
                }                                            
            </style>
        </styles>   

    </model>

    <external>    
        <viewpoint name="Models" heading="0" height="25.83" long="-81.124351" lat="25.426836 " pitch="-89.9" range="28262"/>        
    </external>

</map>
gwaldron commented 11 years ago

Thanks Remo; crashing is bad so I will see that the issue is.

However -- for now, GPU terrain following will not function for icons. It will only work properly for geometries.

gwaldron commented 11 years ago

Fixed the crash. GPU clamping still not "officially" supported for icons, but it does something interesting..