Partially transparent line from alpha channel

classic Classic list List threaded Threaded
3 messages Options
Nikkitta Nikkitta
Reply | Threaded
Open this post in threaded view
|

Partially transparent line from alpha channel

Hi,
I'm drawing a flight path with waypoints symbols. Currently I have this result:



Waypoint symbol is loaded from partially transparent PNG file:



Waypoints are drawn using osgEarth::Annotation::PlaceNode.
Flight path line is simple osg::Geometry with GL_LINE_STRIP.

I want to hide those parts of the Geometry line which are covered by PNG file. But the Earth itself should still be visible.

How can I achieve this? I guess I should use something like getOrCreateStateSet()->setRenderBinDetails but I don't know exactly how.
Best regards,
Nikita Petrov
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Partially transparent line from alpha channel

Nikkitta,
It may or may not be possible. You can try adjusting render bin numbers. PlaceNodes are drawn by the ScreenSpaceLayout code, which defaults to render bin #13; you can change that using ScreenSpaceLayout::setOptions. You would also need to adjust the render bin number of the geometry (usually using a RenderSymbol).

This will only work if the placenode draws first, writing to the depth buffer and "obscuring" the line. But that assumes the line is at the same or greater depth, which is uncertain.

Good luck
Glenn Waldron / Pelican Mapping
Nikkitta Nikkitta
Reply | Threaded
Open this post in threaded view
|

Re: Partially transparent line from alpha channel

Thanks for suggestions, it works almost perfect! Still have a small issue.

For the group with waypoints (PlaceNodes) I've only set:
this->pointSetGroup = new osg::Group;
osg::Depth* depth = new osg::Depth(osg::Depth::LEQUAL, 0.0, 1.0, true);
this->pointSetGroup->getOrCreateStateSet()->setAttributeAndModes(depth, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);

And for Geometry line:
this->geometry = new osg::Geometry;
...
this->geometry->getOrCreateStateSet()->setRenderBinDetails(14, "RenderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);

And here is what I have now (I've changed icons since topic start):



The only problem left is labelText of waypoints, which are now overlapped by a geometry line.
Any ideas how to make labels always visible?
Best regards,
Nikita Petrov