Hi all,

I share the opinion that osgText appearance is suboptimal. We've also
got several complains from our Creative department on the look of the
text in our engine.

I confirm that the cause of the problem is as described by Mark

Having written my own text renderer using OpenGL and FreeType, I can
assess that this is a common problem caused by texture-based text
rendering. Because of texture filtering, it is incorrect to draw the
glyph geometry with the texture coordinates perfectly aligned on the
glyph edges.

Mark already gave the solution to this problem. I.e. The glyph geometry
needs to be larger than the actual glyph so that there is an empty space
around the textured glyph. Doing so allows the texture filtering to be
uniform and complete all around the rendered glyph.


IMHO Mark's proposed patch should be applied, as it solves one of the
biggest visual problem with osgText. And from what I understand, it does
not require any refactoring. I don't think that the depth write
requirement is a problem in most cases (in fact, in my experience, in
many contexts it is incorrect not to disable depth write or depth test
when rendering text).


Cheers,

Tanguy


PS: Using GL_NEAREST does not solve the problem unless the font size is
chosen so that the glyph texels are perfectly aligned to the screen
pixels.



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mark
Sciabica
Sent: 17 July 2009 02:58
To: [email protected]
Subject: Re: [osg-users] osgText Chopping Letters

Hello Mike,

I was also displeased with the appearance of characters in osgText.

The chopping is an artifact of texture filtering and having characters
drawn on the edge of the character cell. Disabling filtering by using
GL_NEAREST for MIN_FILTER and MAG_FILTER should remove the problem. (Or
more accurately, will draw the character with uniformly abrupt
transitions.) The problem with this is that you lose the smoothing of
the text gained by the filtering.

In order to draw properly filtered characters we need to draw the
character cells larger than the extents of the characters to give room
for drawing the intermediate blended texels. Attached is my
implementation of this.

This code requires that you disable depth write (or depth test) since
adjacent characters will now overlap. You also need to call
Font::setGlyphImageMargin(2) since the code looks at more texels around
each character. The end result looks much better in my opinion.

The requirement placed on the depth buffer is the reason I have not
officially submitted this code for inclusion in OSG. If Robert thinks
this is not too high a price for better looking text, perhaps it can be
fixed so we no longer get complaints like yours.

Regards,

Mark


Mike Hall wrote:
> Hi,
>
> We are having an interesting issue where the letters being displayed
using osgText are being being truncated. We can run the text example and
we see the same problem. Specifically, the sides of the letters 'C',
'O', and 'S' are chopped.
>
> Any ideas?
>
> Mike
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=15031#15031
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> org
>   

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to