Robert,

I'm not doing anything to the depth test. If you actually look at the change
being proposed, it is just copying a bit larger of an area for each glyph so
that the anti-aliased edges aren't clipped off.

-Eric

On Thu, Sep 9, 2010 at 11:56 AM, Robert Osfield <[email protected]>wrote:

> HI Eric,
>
> My issue with this approach hasn't changed - it's simply not
> acceptable to disable depth test indiscriminately for Text as it'll
> force text to always appear on top of everything except things
> rendered after it.  Once can workaround this issue by using a
> multi-pass stencil buffer technique.
>
> The proper solution will be to not render simple quads for each glyph
> but compute the intersection between adjacent quads and render the
> glyph as a series of quads so that the overlap share exactly the same
> vertices so will render at the same depth.  Once this is done you can
> keep depth test on, but get fragments with the same depth to pass the
> depth test.
>
> I have some of the design work done for this approach but haven't
> tackled any of the implementation.
>
> Robert.
>
> On Thu, Sep 9, 2010 at 3:50 PM, Eric Sokolowsky <[email protected]>
> wrote:
> > I have long been annoyed by osg::Text clipping characters at random
> times.
> > Way back in March 2008, Mark Sciabica wrote:
> >
> > My solution was to modify osgText to draw larger quads for the
> >
> > character cells (by one texel in each direction), adjusting texture
> > coordinates accordingly. Side effects are that character cells now
> > overlap so depth testing needs to be disabled (or some sort of
> > stenciling operation performed), and extra margin should be allocated
> >
> > for each character in the texture (using Font::setGlyphImageMargin).
> >
> > Mark wrote a patch to osg/src/osgText/Text.cpp which fixes the problem
> for
> > me, but this change was never incorporated into OSG proper. In his
> original
> > message, Mark wrote that this solution required the depth test to be
> > disabled when drawing glyphs to avoid clipping. I did not encounter any
> > problems with clipping when applying his patch. The attached Text.cpp is
> > based on OSG 2.8.3, and I propose it be added and Mark Sciabica be given
> due
> > credit for its inclusion. I am also including a screen shot of some text
> not
> > using the patch (broken-cropped.png) and the same screen using the patch
> > (fixed-cropped.png). The difference is most noticeable on the left edge
> of
> > certain characters such as 'G', but the change also fixes some of the
> hard
> > left edges such as '['. With the fix, all of the left edges are nice and
> > anti-aliased.
> >
> > I'm not sure if the other statement Mark made (extra margin should be
> > allocated for each character in the texture) is needed or not.
> >
> > I'm aware that Robert is doing some fixes to osgText so if these changes
> do
> > not work for the trunk then I'd like to at least have them incorportated
> > into the 2.8 branch.
> >
> > -Eric
> >
> >
> > _______________________________________________
> > osg-submissions mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> >
> >
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to