[osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
Hi all, I have some kind of quality problem with the textured glyphs from osgText. For a display I would like to have text on every node in the scene, with the text staying on top. So I disabled the depth test for all text geodes. Looks good. But when I start to change the text with setText() every second, the textured glyphs get somewhat "dirty"... (See attached picture with GL_DEPTH_TEST off/on) Thanks for any help! Tim. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54604#54604 <>___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
HI Tim, You don't say how you are disabling the depth test, or how this might be affecting the result, so I'm rather left grasping at straws at what might be going on. The only thing I can think of that you are modifying the state attached to the osgText::Text drawable, but as Text plays games with multiple StateSet associated with the osgText::Font as it needs to handle the glyphs spilling out over multiple Texture. This unusually handling of StateSet in Text means that you can't just directly manipulator the Text's StateSet as you'd do with normal osg::Drawable. Instead if you want to modify state for a Text then you should do it via the StateSet attached to the osg::Geode that is the Text's parent. Whether this is the issue in your case I can't say. Robert. On 14 June 2013 11:45, Tim Rambau wrote: > Hi all, > > I have some kind of quality problem with the textured glyphs from osgText. > For a display I would like to have text on every node in the scene, with the > text staying on top. So I disabled the depth test for all text geodes. Looks > good. > > But when I start to change the text with setText() every second, the textured > glyphs get somewhat "dirty"... (See attached picture with GL_DEPTH_TEST > off/on) > > Thanks for any help! > > Tim. > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=54604#54604 > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
Hi Robert, here is my code so far: _font = osgText::readFontFile( "fonts/arial.ttf" ); _text = new osgText::Text; _text->setFont( _font ); _text->setAxisAlignment( osgText::Text::XZ_PLANE ); _textGeode = new osg::Geode; _textGeode->addDrawable( _text ); _textGeode->getOrCreateStateSet()->setMode( GL_DEPTH_TEST, osg::StateAttribute::OFF ); addChild( _textGeode ); _text->setDataVariance( osg::Object::DYNAMIC ); I think I tried everything I found about this topic: different bins, different GlyphImageMargins, etc.. It looks like a problem with the alpha values in combination with small text. Text three times the size does not show this "dirt"... Thanks, Tim. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54607#54607 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
On 14 June 2013 12:11, Tim Rambau wrote: > I think I tried everything I found about this topic: different bins, > different GlyphImageMargins, etc.. It looks like a problem with the alpha > values in combination with small text. Text three times the size does not > show this "dirt"... It could be a lack of alpha blending for some reason. I can't think of anything in your usage which would break the alpha blending. Robert, ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
Hi Robert, I found a dirty hack... I use the good looking version with GL_DEPTH_TEST enabled, but apply a vertex shader for all text nodes with gl_Position.z = 0.0 >=D Tim. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54613#54613 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
Hi Tim, On 14 June 2013 13:40, Tim Rambau wrote: > I found a dirty hack... > I use the good looking version with GL_DEPTH_TEST enabled, but apply a vertex > shader for all text nodes with gl_Position.z = 0.0 Glad to hear that you've found a workaround, it still sounds like a rather odd combination to get things to work, making it sound like something else is amiss that you are just working around. However, given you are providing a workaround, rather than use a shader you could just use the osg::Depth state attribute to change the depth range of the text labels generated, this would avoid the need for the shader. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] osgText with disabled GL_DEPTH_TEST
Hi Robert, you are right. I do not like this "solution" either. I think I have to look deeper inside the osgText::Text.cpp, because the dirty textures only happen, if you change the text. I have two text nodes added to an object, one changes its text, the other does not. The first one gets "more dirty" over time, the second stays clean. :( If I change the fragment shader to Code: gl_FragColor.rgb *= TextureColor.a; I get perfect letters in black boxes. Are the glyph textures mipmaped? Maybe it is an alpha-mipmap problem? Thanks! Tim. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54615#54615 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org