Why is the background not redrawn when using GLOW filter?

Hi there,

I just added a glow filter to make some edges in a graph glow. Unfortunately the glow fills the whole screen when moving the camera. It looks like the background is overdrawn with the rendered image and only where something moves, it doesn’t happen. Hope I explained it understandable. Here is a screenshot - might be a better description of my problem

    public void simpleInitApp()
        // GLOW
        FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
        BloomFilter bloom = new BloomFilter(BloomFilter.GlowMode.Objects);

public Node createVirtualConnectionModel(
        VirtualEdgeInfo info, CVirtualConnectionState state) {
        Material mat = new Material(assets, "Common/MatDefs/Light/Lighting.j3md");
        Node node = new Node("");
        float width = .015f;
        ColorRGBA color = ColorRGBA.Cyan;

        mat.setBoolean("UseMaterialColors", true);
        mat.setColor("Diffuse", color);
        mat.setColor("Ambient", color);

        Cylinder c = new Cylinder(3, 12, width, length, false);
        Geometry cable = new Geometry("Pipe1", c);


        return node;


Your code looks fine from here… so I don’t know.

On another note, I have a red piece of string I’m holding… can you tell me how long it is? :slight_smile:

ah, sorry - forgot to ad it :smiley: I’ll edit and add in the first post

Done, the code is in the first post :slight_smile:


How far off was I? :stuck_out_tongue:


twice the length from the middle to the end

1 Like

Hmm lemme try math too.

Okay so you have the length of the string right?
length = length

it’s not zero so we can multiply both sides with it like so:
length² = length*length

So lets subract length² from both sides for shits and giggles and because I said so.
length²-length² = length*length - length²

Now we can factor the left side as a² − b² equals (a + b)(a − b)
(length + length)(length - length) = length*(length - length)

And since we have (length - length) on both sides we can cancel it out.
(length + length) = length

The end result:
2 length = length

In conclusion, your string is twice the length it actually is. :stuck_out_tongue:
Also length stopped looking like a real word now…

Some friend has shown this logic to me some time ago. I went to figure what’s wrong and if I remeber correctly, there is some division by zero happening in this logic.

1 Like

One error is here.

Should be:
length²-length² = (length*length) - length²

0 = 0

0 = 0 -----> result can be anything

That’s just the way I wrote it, of course you can’t directly subtract from a multiplication.

The joke is here:

And since we have (length - length) on both sides we can cancel it out.

Where length-length = 0, so dividing by zero. Like @grizeldi said.

1 Like

The image looks like you dropped a bloom filter on the gui node. That’s a nono.

P.S. @pspeed the red piece of sting you are holding is as long as the red piece of string you are holding … of course

The “how long is this piece of string I’m holding” thing used to be a regular meme on another mailing list I used to frequent. It was the standard response to anyone posting a question without providing any of the info necessary to solve it. Sometimes they would provide lots of info… just not any of it that matters. (Like the string color in this case.) It stuck with me. Only the person asking the question actually has any of the info necessary to answer their own question… and sometimes in the providing of the additional information they will solve their own issue.

OP forgot to include code. No big deal. Too often this leads to 20 other posts where people take random shots in the dark trying to help with insufficient information. I like to cut off the games of '20 questions" early and after having asked for code in excess of 1000 times it feels good to be a little more creative.

Missing stack traces are my ‘favorite’, though. That’s like having the box the string came in and just not even looking at the length printed right there.

P.S.: If it’s true that the filter is on the guiNode then the other fun thing is that the bad code wasn’t even provided. And then we get to why we ask for simple, and complete, test cases.

1 Like

Well, you guys are so clever - I guess no one of you ever forgot something … spamming the thread really helps.

@pspeed @zissis
I thought I provided all neccessary code - I think I added it to the root Node, not the GUI node.

Here is a complete minimal example:

    public void simpleInitApp()
        // GLOW
        FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
        BloomFilter bloom = new BloomFilter(BloomFilter.GlowMode.Objects);
        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Green);
        mat.setColor("GlowColor", ColorRGBA.Green);
        Box b = new Box(1,1,1);
        Geometry g = new Geometry("",b);
        Picture p = new Picture("background");
        p.setImage(assetManager, "Textures/outdoors.jpg", false);
        p.setPosition(0, 0);
        ViewPort pv = renderManager.createPreView("background", cam);
        pv.setClearFlags(true, true, true);
        viewPort.setClearFlags(false, true, true);

Changing this line to this helps:

viewPort.setClearFlags(true, true, true);

But then the background image isn’t shown any more.

…except the critical bit where you aren’t clearing the background.

Once you attach a filter post processor to a viewport, you can’t show what’s behind it anymore as the framebuffer is managed by the FPP at that point.

Why not just put the image in your regular viewport?

Edit: in general, the problem with partial code snippets instead of full compilable test cases… is that the knowledge of ‘what’s important’ largely intersects with the knowledge to ‘solve the problem’. ie: if you knew exactly what was and wasn’t important then you probably wouldn’t be asking for help. Best to post more rather than less… and a fully functional single class test case is the absolute best way.


Ok. The background image is just for testing. Normally I have the camera picture of an android phone in the background. Will test tomorrow if this is a problem.

Thanks for explaining.

As someone that got my fair share of RTFM’s, LMGTFY’s, gief the needed code or exceptions and being pointed towards the XXX for noobs, I’m in a good position to say there’s a reason for that: it’s actually quite a lot of work to express any of that without hurting someone’s feeling. People like pspeed, normen etc spend hours everyday helping us noobs and they have to be efficient for our own sake (and probably they own sanity)… and these are developer forums… hardly a place where we should expect third dan diplomats.

I wonder if there would be a somewhat easy way to add, in red, on the top of the list of somewhat close questions, a couple sentences to avoid people repeating those same mistakes everyday; something such as:

  • have you googled your question first?
  • have you read the math for dummies / scenegraph for dummies / transparency for dummies / the main documentations?
  • if you still didn’t find the answer, please provide:
    ** the full exception stack if there is one
    ** either the full concerned code or a test case
    ** make sure you tell people what you are trying to achieve
    ** an image if it would be efficient at showing the problem
    And if the person failed there then it should be ready to accept it might look bad for that reason.

NB: or maybe have that text appear in the content box of the question when a new thread is started.

But mostly, we all should be less ready to jump in a fight for nothing.

Not jumping on the poster as I have done all those errors myself.


* facepalm * … didn’t add it to the gui node he said … Later on he posts that he set the clear flags … effectively doing to the normal view port what is done to the gui node. I agree with @pspeed. If you don’t know what is wrong please post the entire code block so someone can help you understand what’s wrong. Red string strikes again.

Don’t mind me. I just woke up from a long night of coding a metal shader.

very useful feedback