Enable BloomFilter in AbstractControl


I have created an AbstractControl that I add to geometries. In the control I want to highlight / make geometry stand out and I am trying to do this by applying a BloomFilter threw the AbstractControl added to the geom.

I am using the following code in the function render() in my AbstractControl class. I have previously passed the assetManager threw the constructor, tho I did read some where it is not recommended.
public void render(RenderManager rm, ViewPort vp) {
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
BloomFilter bloom = new BloomFilter();

The code works when used in initialize method of an AbstracAppState, but now when I try to use it like this in a AbstractControl. Note: I only want use BloomFilter on geoms that have this controller. Leaving only the wrench in the image bellow to be affected by the BloomFilter.

  • Olav

Aieaieaie…A filter must be added once…render(…) is called each frame update…so now, you create a new filterProcessor wich contains one new bloomFilter on each frame but don’t setup a bloomColor or a bloomColorMap nowhere !

Let the render method empty…initialize your filter when you setup your game (in simpleInitApp() for example) and read this topic for setup something that the filter have to render glowing (in the setSpatial(…) of your control for example).

1 Like

Thanks for the clarification!

Added the following filter to application initialization.
FilterPostProcessor fpp=new FilterPostProcessor(assetManager);
BloomFilter bloom=new BloomFilter(BloomFilter.GlowMode.Objects);
//BloomFilter bloom=new BloomFilter();

Learned that BloomFilter with no parameters will light up the whole world. Added BloomFilter.GlowMode.Objects so only objects assigned with .setColor(“GlowColor”, color) would be affected.

In the AbstractControl, I added the following code in the setSpatial()
Material shinyMat = new Material( assetManager, “Common/MatDefs/Light/Lighting.j3md”);
shinyMat.setColor(“GlowColor”, ColorRGBA.Blue);

Okay, blue might not be what I am going for. However here is the results I got.