[osg-users] Text Outline pixelated on close up

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Mon May 18 13:14:01 PDT 2020


Hi,

I'm creating text objects that lie over the map, indicating the name of 
some cities. Pure white text was hard to read (the background represents 
vegetation, so it's colored, but some parts are white). Adding an outline 
solved that, but on close up, the outline looks pixelated and ugly. Using a 
drop_shadow also looks fine from a distance, but strange from a small 
distance, since the black shadow doesn't touch the white text. Is there 
something I can do to improve the appearance of the outline from close up, 
or to reduce the distance between the shadow and the text?

osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& 
label, osgText::Text::AxisAlignment axisAlignment)
{
    osg::Geode* geode = new osg::Geode();
    {
        osgText::Text* text = new osgText::Text;
        geode->addDrawable( text );
        text->setPosition(pos);
        text->setCharacterSize(size);
        text->setAxisAlignment(axisAlignment);
        text->setAlignment(osgText::Text::CENTER_CENTER);
        text->setBackdropType(osgText::Text::OUTLINE); // 
DROP_SHADOW_BOTTOM_RIGHT
        text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.5f));
        std::string dest = desaxUTF8( label );
        text->setText( dest );
    }
    return geode;
}

Thanks,

Rodrigo.

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/82ad1cc1-ec3d-4397-96d3-4bd4dc907c05%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200518/578bcd43/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_outline_close.jpg
Type: image/jpeg
Size: 126836 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200518/578bcd43/attachment-0004.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_outline_far.jpg
Type: image/jpeg
Size: 311354 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200518/578bcd43/attachment-0005.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_shadow_close.jpg
Type: image/jpeg
Size: 158265 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200518/578bcd43/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_shadow_far.jpg
Type: image/jpeg
Size: 267213 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200518/578bcd43/attachment-0007.jpg>


More information about the osg-users mailing list