🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Changing outline color (BFG 1.9 alpha 5)

Started by
4 comments, last by WitchLord 17 years, 3 months ago
Hello everybody. I'm using Bitmap font generator 1.9 alpha 5, and liked a lot the Outline effect. As I can easily change the font color in OpenGL, my text messages now look better. However, I would like to know if there is any way to change the font outline color in Bitmap font generator or with OpenGL code. Thanks.
Advertisement
It can be done programtically in code, of course, and it's actually fairly simple, assuming you've loaded the bitmap into memory. The simpler solution, if it's always going to be the same color, is to just open it in photoshop and slap a colorizer layer on it. Gimp, though it sucks in general, can get the job done fine. If you're going to have lots of different colors, you might as well just use OpenGL's vertex coloring.
Thanks for your answer, Deyja.

I had thought of the Photoshop/Gimp method. But I was curious about methods using BFG directly or OpenGL.

The problem with vertex coloring is that I want to change only the outline (to a single color, e.g. gray) while the "inner" portion of the font is to be colored by OpenGL's vertex coloring, which allows for gradient. However, I think vertex coloring will modify colors of the entire letter (including the outline), not just its inner body. So perhaps the Photoshop/Gimp method is easier.

Thanks again.
To do different colors in OpenGL like that, you might have to draw the text twice. First a non-outlined version with the gradient, then again as outline only.

This isn't a problem specific to BMFont, it has to do with using vertex shading in general, so you would get a lot more help in the OpenGL forum.

Agreed. Thanks a lot for your help.
Currently the only way of changing the color of the outline with only one pass is through pixel shaders. The pixel shader can change the color of the outline and the character separately, by interpreting the texture color as the linear interpolation factor between the character color and the outline color. If it is black then only the outline color is used, if it is white then only the character color is used, otherwise a blend of the two colors is used.

Without pixel shaders, you're best of drawing the text twice, once for the outline and then another time for the character. In this case you would be best of not using the outline generated by BMFont, and instead adding the outline pixels in Photoshop or GIMP as suggested by Deyja. Add padding to the characters in BMFont to add the extra room for the outline.

I'll add more options to BMFont to support generation of characters for this purpose in the future, e.g. Thickening the characters, Generating outline with hollow characters, Generating drop shadows, Generating blurred chars, etc.

I can also add support for pre colored characters with a separate color for outline. Though I do not consider this a very good option as it would require full 32bit for all characters, whereas currently characters can easily be stored in 8bits only.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement