[World] Serendipity
Daniel Phillips
phillips at phunq.net
Wed May 23 23:10:09 PDT 2012
I added code to render the font album using pure alpha blending instead of a
full color rgba map as in the previous images. Guess what? My rgba hack looks
better... a lot better. You be the judge, compare font10.png, rendered
"properly" as an alpha texture, to font11.png, rendered as rgba with hacked
alpha.
No contest, right? If you look really closely the rgba version seems to have a
dark border. I caused that by amplifying the alpha values all across the
colored region of the glyph in an attempt to make the solid color region
stronger and the transparent blending region smaller. It had the side effect of
amplifying some of the surrounding black pixels too. It is a subtle change,
but the visual effect is not subtle... something about it tricks the eye into
perceiving a really sharp boundary.
To be honest, I never would have considered hand rolling an alpha map like
this instead of following the standard recipe, if my image loader had not been
broken. And would therefore not have discovered this cute trick to sharpen up
tiny fonts. See Serendipity, above.
The alpha map loader is fixed now because it has a lot of uses, and boy was
that a fight. There is a weird gotcha with loading odd sized textures in
OpenGL. You have to tell OpenGL to use single-byte alignment, and you
basically have to read all the documentation in the world to know that, which
nobody ever does including me. The default behavior is to turn your nice image
into random scribbles.
OK, this is going to be a flag on bitmap font creation. You can optionally have
single byte text that isn't as pretty (but who knows, it might be better
sometimes) or you can use four times the texture memory and have sharp text.
Anyway, I guess this short diversion into the land of bizarre color effects
turned out to be worth it.
Regards,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phunq.net/pipermail/world/attachments/20120523/6507d8c6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font10.png
Type: image/png
Size: 2282 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120523/6507d8c6/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font11.png
Type: image/png
Size: 2337 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120523/6507d8c6/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font12.png
Type: image/png
Size: 20111 bytes
Desc: not available
URL: <http://phunq.net/pipermail/world/attachments/20120523/6507d8c6/attachment-0005.png>
More information about the World
mailing list