controlling the draw order of osgEarth LabelNodes. #2422
-
Hello dear OsgEarth community. as seen, the label 'object 1' is drawn on cube and it is overwriting its pixels. i have tried various functions such as label->setOcclusionCulling(true) and label->setPriority(negative_or_positive_value); or even tried to change its RenderBinDetails from its osg::StateSet to a big number such as label->getOrCreateStateSet()->setRenderBinDetails(999, "RenderBin"), but all it does is that it makes it not being displayed. how can i controll the draw order of the LabelNode such that other objects would always occulude if they were to occupy the same pixels. any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
LabelNodes are not like normal scene objects. They draw in a screen-space overlay after the rest of the scene renders. The only way to get them to "interact" with the scene objects is by using the occlusion culling option. This option intersects a ray from the camera to the label's position, and if it hits anything, it skips drawing the label. The occlusion culling also has a global max altitude at which is takes effect -- perhaps you need to increase this by calling If you want complete 3D sorting and rendering for text, you will need to instead use osgEarth::Text objects directly in your code. Hope this helps. |
Beta Was this translation helpful? Give feedback.
LabelNodes are not like normal scene objects. They draw in a screen-space overlay after the rest of the scene renders. The only way to get them to "interact" with the scene objects is by using the occlusion culling option. This option intersects a ray from the camera to the label's position, and if it hits anything, it skips drawing the label.
The occlusion culling also has a global max altitude at which is takes effect -- perhaps you need to increase this by calling
AnnotationSettings::setOcclusionCullingMaxAltitude(...)
-- the default value is 200000m.If you want complete 3D sorting and rendering for text, you will need to instead use osgEarth::Text objects directly in your code.
Hope …