Applying FilterPostProcessors to part of scene

Hi,



The last few weeks I’ve been using jMonkey to develop a simple game.

Recently I discovered the FilterPostProcessor’s, which saved me a lot of time.



However, when I added text (BitmapFont) to my scene to show the player’s score, it became unreadable because of the Bloomfilter.

Is it possible to ignore some of the objects when applying the filters?

Attach your texts to the guiNode, instead of the rootNode.

nehon said:
Attach your texts to the guiNode, instead of the rootNode.


Thanks for the quick reply, but somehow I fail to get the text to display.

[java] BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); // see http://hub.jmonkeyengine.org/groups/general-2/forum/topic/cannot-load-fonts/
txt = new BitmapText(fnt, false);
txt.setBox(new Rectangle(1f, 1f, 20, 20)); // 0.7 for best result
txt.setQueueBucket(Bucket.Opaque);
txt.setSize(1.5f);
txt.setText("SCORE:n" + score);
txt.setColor(ColorRGBA.Red);
guiNode.attachChild(txt);[/java]

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:hud



size units when using the guiNode are in a magnitude of pixels, not 3d world units.

it seems your rectangle is only about 20 pixels square and your text size is 1.5 pixels high.

i am guessing here, but increasing these sizes should at least show you something.

also, if you didnt already (i dont see it in this snippet), be sure to declare your variable txt before defining it.

lastly, i think x and y coordinates on the guiNode are measured with 0, 0 being the bottom left corner of the viewport (with positive x moving ‘right’ and positive y moving ‘up’ with z dimension being the depth buffer) and the rectangle() constructor orients the upper left corner of the box, so new Rectangle(1f, 1f, 20, 20) seems to make a box at the bottom left of the viewport with 19 pixels hanging below the viewable portion of the screen.

not sure if these things are causing your actual issue, but i hope something i added helps.

1 Like

Works like a charm when I copy the sample code on the wiki.

Seems that I can also abuse it for pictures :slight_smile:



Thanks! This saved me a lot of time.