[osg-users] Please test OpenSceneGraph-3.6 branch in prep for 3.6.1

Robert Osfield robert.osfield at gmail.com
Tue Apr 24 04:22:24 PDT 2018

Hi Daniel,

On 23 April 2018 at 20:46, Daniel Emminizer, Code 5773
<dan.emminizer at nrl.navy.mil> wrote:
> I also added a status display text to the lower left that is similar to something we're doing in our HUD.  In arial you can see the text bouncing.  If you press "2", it changes between Times and Arial:
> - Times looks worse than Arial with a drop shadow, at the same font size
> - You can see the fading effect in Arial as the text moves left and right
> You can also toggle the lower-left corner's drop shadow using the "1" key.  The intent is to demonstrate that the shifting text is not due to the shadow as I first thought.  It also is intended to demonstrate the visibility problems I am having.  We had been using drop shadows to make the text more readable against similar colored backgrounds.  But in 3.6, it actually makes it harder to read the same text, especially at smaller font size.
> You can find demonstrations of this in the attached osgtext.cpp.  Feel free to ignore the first attachment -- this includes those changes and more, with only the relevant code and not the rest of osgtext.
> I hope this example helps demonstrate the problems I'm seeing.

The example makes the shadow quality clear. In the case of arial.ttf,
it's a font that has body of the glyph pixel wide or even alpha'd at
the default font resolution of 32x32 so causes more problems when you
start blending, which is why things look worst for arial.ttf.

I have experimented with various changes to the
OpenSceneGraph-Data/shaders/text.frag shader that does the fragment
shading for osgText (in 3.6 onwards). I've found that applying a power
function to the alpha value of the glyph and it's shadow results in
clear text and shadow, and overall I think this is a decent enough
improvement to consider.  I've attached my
OpenSceneGraph-Data/shaders/text.frag, could you copy this into your
OpenSceneGraph-Data/shaders directory (if you don't have one yet check
it out and then make sure OSG_FILE_PATH points to the location of your
OpenSceneGraph-Data.)  If this works better then I'll regenerate the
shaders that are built into osgText (see src/osgText/shaders/*.cpp.)

I have yet looked at the bounding box side of things in detail.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: text.frag
Type: application/octet-stream
Size: 7734 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180424/b97272cf/attachment.obj>

More information about the osg-users mailing list