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$
  • $\begingroup$ Could you upload a .blend file? $\endgroup$ – user2859 Apr 8 '14 at 8:38
  • $\begingroup$ This tutorial or this one may help. $\endgroup$ – sambler Apr 8 '14 at 11:23
  • $\begingroup$ @user2859: I have uploaded a .blend file now. Thank you. $\endgroup$ – Thomas Weller Apr 8 '14 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 Apr 8 '14 at 14:31
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$
  • $\begingroup$ This does the trick. Is this setting not availabe in the UI, only in Python? $\endgroup$ – Thomas Weller Apr 8 '14 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 Apr 8 '14 at 14:57
  • $\begingroup$ Hi! Could you recommend me a good resolution for my text so it looks good for my car gauges? $\endgroup$ – Adrians Netlis Dec 26 '14 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$ – Scalia Apr 5 '15 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 Jul 27 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.