Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

classic Classic list List threaded Threaded
7 messages Options
Bin.L Bin.L
Reply | Threaded
Open this post in threaded view
|

Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

    Hi!
    When I testing application in osgearth3.0,if use this code:
osgViewer->setComputeNearFarMode(COMPUTE_NEAR_FAR_USING_PRIMITIVES); or
osgViewer->setComputeNearFarMode(DO_NOT_COMPUTE_NEAR_FAR);
the earty dispear,When I change viewpoint, I can see a part of earth.
    the earthFile use TMS image layer and TIFF file Elevation data.
    How to fix this problem?
    Thanks!

    PS:if I use COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES,the line drawing in osg near to the land can't show normal,so I need to use COMPUTE_NEAR_FAR_USING_PRIMITIVES.
osgearth for aircraft display
Bin.L Bin.L
Reply | Threaded
Open this post in threaded view
|

Re: Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

    Update
    In osgearth3.0 application,use COMPUTE_NEAR_FAR_USING_PRIMITIVES the earth show normal,but if use DO_NOT_COMPUTE_NEAR_FAR,the earth can't show, just can see the sun,stars.But in my own progrem, if I use COMPUTE_NEAR_FAR_USING_PRIMITIVES ,the earth can't show normal, it just like a black hole in the earth, maybe is the problem about cull? But I set the cullmode,it doesn't work;
    Is there any way to solve the problem?  Thanks a lot!
osgearth for aircraft display
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

Why do you need to use COMPUTE_NEAR_FAR_USING_PRIMITIVES or DO_NOT_COMPUTE_NEAR_FAR?
Glenn Waldron / Pelican Mapping
Bin.L Bin.L
Reply | Threaded
Open this post in threaded view
|

Re: Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

    Hi, gwaldron. Thanks for your reply.
    I need to draw many aircraft tracks in the earth. if I use osgEarth::Feature to draw the line, the draw time become very long. I have a high demand for performance. So I use osg::Geometry to do it.
    But there is a problem that if the line's altitude below 200 meter ,the line can't show normal, they become dotted. in osgearth 2.8, I use COMPUTE_NEAR_FAR_USING_PRIMITIVES to solve the problem.But In osgearth 3.0, this method can't work.
    Is there any method to solve it?
    Thanks!
osgearth for aircraft display
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

You can try a couple of things. First, try installing the logarithmic depth buffer, like so:

LogarithmicDepthBuffer buf;
buf.install( viewer.getCamera() );

This will re-organize the depth buffer to give you better results when your scene is very large.

You can also apply a depth-offset to your feature to help alleviate depth sorting issues when the feature and terrain are very close (compared to the size of the scene). This is applied to the Style:

RenderSymbol* render = style.getOrCreate<RenderSymbol>();
render->depthOffset()->enabled() = true;

Hope this helps.

Glenn Waldron / Pelican Mapping
Bin.L Bin.L
Reply | Threaded
Open this post in threaded view
|

Re: Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

Thanks a lot! I'll try it soon.
osgearth for aircraft display
Bin.L Bin.L
Reply | Threaded
Open this post in threaded view
|

Re: Earth dispear in osgearth3.0 when using COMPUTE_NEAR_FAR_USING_PRIMITIVES

In reply to this post by gwaldron
    The problem solved.
    Installing the logarithmic depth buffer works, But there are other display problem occur.
    The second method works. Because I use the osg::geode to draw line, So I set GL_DEPTH_TEST off to solve the problem.
    Thanks for your reply! It really help me a lot.
osgearth for aircraft display