I’m trying to create BitmapText that looks inset, or carved into an object, by applying a certain material to it. My problem is that the material gets applied to the bounding box of the text instead of to the text itself. Is there anyway to set the material to the font only and not render the material in the bounding box? Here is my code:
BitmapFont font = assetManager.loadFont("Interface/Fonts/Trajax.fnt");
BitmapText text = new BitmapText(font);
Material textMat = this.getUnshadedMat();
Texture textTexture = assetManager.loadTexture("Textures/Terrain/textTexture.png");
textMat.setTexture("ColorMap", textTexture);
text.setMaterial(textMat);
text.setSize(4);
text.setText("Here's some text!");
As far as i know this is how Text is built in jmonkey:different Quads attached each other with a letter and an alpha background. You should probably create another system for building 3d text.
That’s right… BitmapText is… wait for it… made of BITMAPs… ie: images on quads. If you change the material then you get rid of the bitmap… which gets rid of the text. Then you are just left with letter sized quads.
Ok, that’s what I was afraid of. I was trying to make sure there was no
workaround before proceeding onto a more difficult approach. I thought
there may be some way to access the underlying construction of the text and
apply the material to the text generated (just like you can change and set
the color but do it with a material instead).
The ‘text’ is just a big texture with all of the letters in it… the letters are white. Those letters are then mapped to quads using a texture coordinate but it’s easy to change their color from white with a multiply in the material.