BloomFilter artifacts


Adding BloomFilter in the beginning of simpleInitApp in HelloEffects or HelloMaterial applications produces strange artifacts:

FilterPostProcessor filterPostProcessor = new FilterPostProcessor(assetManager);
    BloomFilter bloom = new BloomFilter(BloomFilter.GlowMode.Objects);

Videocard is AMD Mobility Radeon HD 4570 with the latest drivers. Windows 7. JMonkeyEngine was built from master some weeks ago.

Same code with the same JMonkeyEngine does not show any artifacts on Nvidia GTX 760 under Windows 7.

Playing with BlendMode for transparent material or changing GlowMode does not fix the issue for system with AMD card.

As my project requires glowing material I need to activate BloomFilter. I also need ParticleEmitter and transparent objects. Is there any other way to achieve glow effect without BloomFilter? Or is there any thought what potentially causes this problem, so I can investigate JMonkeyEngine code and fix it?

Thank you!

GlowMode.Objects waits for a GlowColor set on the material. If you did not set it, the GPU will use whatever is in the memory…

Hi Nehon! Thank you for the response! There is no difference for the transparent material, if I set up GlowColor or remove GlowMap parameters like this:

    Box cube2Mesh = new Box( 1f,1f,0.01f);
    Geometry cube2Geo = new Geometry("window frame", cube2Mesh);
    Material cube2Mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    cube2Mat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
    cube2Mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);  // activate transparency

Transparent object is still greenish and there are squares for the ParticleEmitter. Do I set up GlowColor correctly?

BloomFilter.GlowMode.Scene produces the same artifacts, just whole scene is blooming.

If to remove BloomFilter, then everything is ok, But it means, that I can’t use glow for other materials, where required.

If to use custom material definition based on Unshaded.j3md, where GlowMap, GlowColor and Technique Glow are removed, then the artifacts are still present for objects with custom material, when BloomFilter is used. For some reason BloomFilter affects transparent objects.

Update: Artifacts show up after adding any filter, not only BloomFilter.

Update 2: I guess I have found the reason of the problem.

FilterPostProcessor has such code:

if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) { fbFormat = Format.RGB8; }

Radeon HD 4570 reports, that it supports PackedFloatTexture, so fbFormat is kept with its default value Format.RGB111110F. If to force fbFormat = Format.RGB8; then no artifacts are present.

So, looks like either logic, which sets fbFormat is incorrect, or drivers don’t support PackedFloatTexture. In any case, it would be nice to have a possibility to set up fbFormat manually during FilterPostProcessor.initialize. Unfortunatelly fbFormat has private access, so it is impossible to change its value in derived classes. Though it is possible to use a workaround: renderer.getCaps().remove(Caps.PackedFloatTexture);

I had a similar problem months ago. What if you add a TranslucentBucketFilter before the BloomFilter on your FilterPostProcessor?

Adding TranslucentBucketFilter before the BloomFilter does not fix the artifacts. Currently only setting fbFormat = Format.RGB8; inside FilterPostProcessor fixes the issue.