Text in the Game Engine.
Posted by BrianH | Filed under Blender Tutorial
One of the most annoying bugs in the Blender Game Engine was coloring text. Pre-2.48, the only way to color text was to use Vertex Painting. Since the introduction of GLSL into the Game Engine, things have been reworked and now it’s much easier to color text objects, even those which use the same UV font texture. For those who’ve never actually used text in the Game Engine, I’ll give you a quick and dirty introduction.
Creating text objects in the Blender Game Engine is very easy. It’s done through the use of a bitmap font texture, UV mapped in a unique way to a plane object. Simply put, add a plane to your scene and then add a new UV Texture map to the object through the Editing buttons. While in Edit Mode, open a new window with the UV/Image Editor window inside. You could change the current view too if you lack the window space to make a new one. Select Load in the header and choose the font image you wish to use.
Note: Blender Font Textures are specially crafted to be used in Blender. You cannot use any image as a font set. There is specific data that’s embedded into the top of the image to define individual letters. There are converters designed to convert TTF font’s into Blender Bitmap Font Textures, or you can download and use one of these font’s.
Blender Font's (unknown, 601 hits)
Now that your image is loaded, arrange the UV coordinates so that they surround the @ symbol like so. And make the following changes in your Texture Face menu (Tex, Text, Alpha).
So now that you have a fine looking letter object, let’s make some words. Under your Logic buttons panel, add a new property. Change it to a string type and set it’s value to what ever you like. Congradulations, you have finished creating a word(s) in the Blender Game Engine.
Now, you’d like to change it’s color? Easy enough. Previously, you would have needed to use Vertex Painting to change the color of the text and you weren’t able to use the same UV font texture on multiple text objects with different color settings. With 2.48, it’s a breeze. Ensure you game settings are set to “Blender Multitexture Materials”. This will use the material settings for object textures in your game. Now, apply a new material to your text, enable Shadeless, add a new Texture (leave at default settings), and then change the Diffuse Color to what ever you like. If you messed up and have colored blocks for your letters, reread the instruction and try again with a new material.
When you play the game, you will see that the text is working and is colored according to the material settings. You could easily duplicate this text object and change the property settings and material settings to easily create more text objects.
7 Responses to “Text in the Game Engine.”
-
nodoy1 Says:
February 17th, 2009 at 8:57 amHi,
I am trying to follow this tutorial and I have a problem with the letters that I put in the string property Text. The only thing that appears in Blender is the @ for every letter and without spaces. Could you help me to solve this problem, please ? -
BrianH Says:
February 17th, 2009 at 10:01 amIt sounds like you need to enable “Tex” under the Texture Face settings.
-
blenladen Says:
June 21st, 2009 at 7:13 amThis and other tutorials fail to mention 2 vital points in the process:
1. You need to add a UV Texture by pressing the New button (inside of the Edit panel–>Mesh tab)….
2. The name of the property *must be* “Text”….Several other tutorials don’t mention this…what a shame I just spent 2 whole days because of that.
-
BrianH Says:
June 21st, 2009 at 7:39 am@ blenladen:
Actually, I do mention that you need to assign a UV Texture through the Edit buttons – Quote: “Simply put, add a plane to your scene and then add a new UV Texture map to the object through the Editing buttons.”
But you are right about the property needing to be named “Text”. I’ll add that into the article.
-
Anonymous Says:
September 16th, 2009 at 10:50 amAnd why so little became such interesting blogs, thank you!
-
game engine Says:
March 15th, 2010 at 7:51 amYou should put a couple of more ads on your site as you could in all likelihood make a good deal of money. This is great writing.
-
BrianH Says:
April 3rd, 2010 at 7:47 pmI enjoy keeping a clean ad-free reading experience for my readers, however I do accept PayPal donations. Your donations are greatly appreciated.

