(solved) Jagged BitmapText used with BillboardControl

EDIT: By using the Font Creator Plugin and - > New File, Font and choosing a larger font size and image size the text is more clear.



I am using BitmapText with BillboardControl to show a text above my models. It works but the text seems a bit jagged/ugly. See the image.



Here is the code I use:

[java]

// Set position above model

Vector3f newPos = new Vector3f(pos.x, pos.y + 5.0f, pos.z);

// Load font and create the Text

BitmapFont font = app.getAssetManager().loadFont(“Interface/Fonts/Verdana.fnt”);

BitmapText bmText = new BitmapText(font, false);

bmText.setSize(3);

bmText.setText(txt);

bmText.setQueueBucket(Bucket.Transparent);

bmText.setColor(ColorRGBA.White);

// Create node and add a BillboardControl so it rotates with the cam

BillboardControl bbControl = new BillboardControl();

bbControl.setAlignment(BillboardControl.Alignment.Screen);

Node textNode = new Node(“Node for text”);

textNode.setLocalTranslation(newPos);

textNode.setCullHint(CullHint.Never);

textNode.attachChild(bmText);

textNode.addControl(bbControl);

// Add the node to root node

app.getRootNode().attachChild(textNode);

[/java]

Is there anything I can do to increase the text quality ?

1 Like

Use a higher resolution font?

Hello,



Sorry in advance if my problem is already solved somewhere, but I did not find anything.

Also, I know that this post is solved, but the picture will certainly help :slight_smile:



My problem is centering some 3D texts above 3D models, using BitmapText and BillboardControl…



For example, just like in the picture, you can see the text “City 1”, starting with its char “C” at the center of the cube.

If I put some modifier like “setLocalTranslation(cube.x - 1f, cube.y , cube.z)”, I get some weird text rotation while turning around the cube with camera.

Any idea ?

@kriss4realms said:
Hello,

Sorry in advance if my problem is already solved somewhere, but I did not find anything.
Also, I know that this post is solved, but the picture will certainly help :)

My problem is centering some 3D texts above 3D models, using BitmapText and BillboardControl...

For example, just like in the picture, you can see the text "City 1", starting with its char "C" at the center of the cube.
If I put some modifier like "setLocalTranslation(cube.x - 1f, cube.y , cube.z)", I get some weird text rotation while turning around the cube with camera.
Any idea ?


In general, start a new topic when asking a brand new question instead of resurrecting a 9 month old unrelated thread.

It sounds like you are putting your billboard control right on the BitmapText. It will always rotate around the local origin which will not move when you change local translation. You'd need to put the bitmap text under a node, move the bitmap text to offset it, and then put the billboard control on the node instead of BitmapText. If you don't understand the relationships I'm talking about then it would be worth going through this a few times until it clicks: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies
1 Like

In general, start a new topic when asking a brand new question instead of resurrecting a 9 month old unrelated thread.


I knew that you would told something like that :p

Ty for your reply and Omg :o sure I understand ! but that sounds so easy that i feel idiot now...

Thank you again pspeed !