Hi everyone!
I am trying to render textured quads in a 3D scene to draw some texts.
The bitmaps I’m using behaves as alpha maps, with A=0 for the backgound, A=1 for the glyphs and in-between values at the boundaries between the glyphs and the background.
Since those texts are actually part of the scene and could be arbitrarily placed in the 3D space I think I need to draw them with depth testing enabled and alpha clipping to prevent the “transparent” portions of the quads from occluding what’s behind them.
The problem is that I don’t know how to blend the semitransparent pixels of the textured quads with the rest of the scene:
setting an alpha treshold such that only 100% opaque pixels are drawn would result in jagged edges while lowering the threshold and enabling blending (add, SrcA, 1-SrcA) gives me unpleasant outlines around the texts.
What options do I have? Should I draw those entities with 2 passes (one for the fully opauqe part of the quad and one for the semitransparent part after all the opaque entities have been drawn)?
Is there any reference / article about the topic? How has the same problem been solved for foliage/grass rendering in videogames?