OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgText with disabled GL_DEPTH_TEST


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins]
View previous topic :: View next topic  
Author Message
TimR
Newbie


Joined: 30 Oct 2012
Posts: 16

PostPosted: Fri Jun 14, 2013 10:45 am    Post subject:
osgText with disabled GL_DEPTH_TEST
Reply with quote

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.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12206

PostPosted: Fri Jun 14, 2013 10:55 am    Post subject:
osgText with disabled GL_DEPTH_TEST
Reply with quote

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:
Quote:
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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
TimR
Newbie


Joined: 30 Oct 2012
Posts: 16

PostPosted: Fri Jun 14, 2013 11:10 am    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12206

PostPosted: Fri Jun 14, 2013 11:55 am    Post subject:
osgText with disabled GL_DEPTH_TEST
Reply with quote

On 14 June 2013 12:11, Tim Rambau <> wrote:
Quote:
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,


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
TimR
Newbie


Joined: 30 Oct 2012
Posts: 16

PostPosted: Fri Jun 14, 2013 12:40 pm    Post subject:
Reply with quote

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
Twisted Evil

Tim.
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12206

PostPosted: Fri Jun 14, 2013 12:47 pm    Post subject:
osgText with disabled GL_DEPTH_TEST
Reply with quote

Hi Tim,

On 14 June 2013 13:40, Tim Rambau <> wrote:
Quote:
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.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
TimR
Newbie


Joined: 30 Oct 2012
Posts: 16

PostPosted: Fri Jun 14, 2013 1:12 pm    Post subject:
Reply with quote

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. Sad
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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts osgText crash with multiple Viewers ravidavi General 3 Tue Dec 18, 2018 8:50 am View latest post
No new posts A question of "ShaderPipeline di... loening General 0 Tue Nov 13, 2018 5:31 pm View latest post
No new posts osgText 3.6.3 crash Trajce Nikolov NICK General 2 Wed Sep 12, 2018 12:25 pm View latest post
No new posts osgText: two thread-safety issues gwaldron General 1 Tue Jul 31, 2018 2:54 pm View latest post
No new posts Extra draw calls in osgText? gwaldron General 1 Thu Jul 19, 2018 8:48 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP