Sign in to follow this  
narumi

Changing outline color (BFG 1.9 alpha 5)

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this