8
$\begingroup$

Within my game I have some cubes with text which render fine. In addition to the cubes I want to display some static text, e.g. the current score. The score text has the camera as parent and a copy rotation constraint on the camera.

While this concept works fine in principle, the score text is displayed very pixelated. I already increased the font size to 50 and made the text smaller by scaling it down, but it still doesn't show nicely.

The score text is about 11 Blender units away from the camera. If I move the score text further away, it displays better, but then the text interferes (collides) with the cubes.

What could I do to improve the quality of this text?

Download SSCCE .blend file. Open the SSCCE in Blender 2.70. Hover your mouse over the 3D viewport. Press P to start game engine.

Screenshot

$\endgroup$
4
  • $\begingroup$ Could you upload a .blend file? $\endgroup$
    – user2859
    Commented Apr 8, 2014 at 8:38
  • $\begingroup$ This tutorial or this one may help. $\endgroup$
    – sambler
    Commented Apr 8, 2014 at 11:23
  • $\begingroup$ @user2859: I have uploaded a .blend file now. Thank you. $\endgroup$ Commented Apr 8, 2014 at 13:00
  • $\begingroup$ I posted my answer but i don´t recommend using text objects at all, since they are a hack right now. The other problems you get are no depth sorting, does not respect materials, Z buffer issues, no alignment. I recommend using this method. If anything you could use text objects to render text off-screen and combine it with the uv mapping technique. $\endgroup$
    – user2859
    Commented Apr 8, 2014 at 14:31

2 Answers 2

7
$\begingroup$

You can fix the resolution through the python API:

import bge

scene = bge.logic.getCurrentScene()
for obj in scene.objects:
    if obj.name == "Text": # text object we want to fix
        obj.resolution = 8.0 # resolution is normaly 1.0 / 72 dpi
$\endgroup$
6
  • $\begingroup$ This does the trick. Is this setting not availabe in the UI, only in Python? $\endgroup$ Commented Apr 8, 2014 at 14:56
  • $\begingroup$ See my comment on your question. Its a bit of a hack right now. The other method will work better I think. $\endgroup$
    – user2859
    Commented Apr 8, 2014 at 14:57
  • $\begingroup$ Hi! Could you recommend me a good resolution for my text so it looks good for my car gauges? $\endgroup$ Commented Dec 26, 2014 at 20:11
  • $\begingroup$ @AdriansNetlis your car gauges don't need dynamic text, they can be a mesh or an image mapped to plane. $\endgroup$
    – ruckus
    Commented Apr 5, 2015 at 16:52
  • 3
    $\begingroup$ Please be aware that rendering text at 8x resolution as suggested will take up a LOT more graphic memory. (128x128 will becomes 1024x1024) It will even fail on lesser graphics cards. Use the smallest number you can stand. $\endgroup$
    – Mike Pan
    Commented Jul 27, 2015 at 19:50
0
$\begingroup$

It is literally a scaling problem. you cannot scale a text to fit your scene. you must scale your scene to fit the text. never scale down your text from when you first create it. Ill never let the BGE go. its gone from updated Blender. but I will always make games in the BGE. you can get a old copy of Blender from their site. 2.79 was the last version to have the Game Engine. Also to answer your question better. You should probably use an overlay scene for all scoring and other text, that way the text will never collide with anything and you can scale your HUD scene as much as you need. if your text is to big on the screen then just pull your camera away, for HUD style small text I put my cam about 40 Blender Units away from the text

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .