You already know a way to add glows: the GlowMap
and GlowColor
parameters in materials. A bloom filter results in the same halo-like glow, but it is applied scene-wide.
Let's apply a glow to our scene:
Make a copy of
Main.java
and name the classBloomGlow.java
. Remember to also refactor the first line of themain()
method toBloomGlow app = new BloomGlow()
.Add three class fields: one for the scene, one for the
FilterPostProcessor
, and one for the bloom filter (from thecom.jme3.post.filters
package):private Spatial sceneGeo; private FilterPostProcessor fpp; private BloomFilter bloom;
Initialize
bloom
andfpp
in thesimpleInitApp()
method. Add theFilterPostProcessor
to theviewPort
, and add theBloomFilter
to theFilterPostProcessor
:public void simpleInitApp() { fpp = new FilterPostProcessor(assetManager); viewPort.addProcessor(fpp); bloom = new BloomFilter(); fpp.addFilter(bloom);
Load and attach a scene of your choice, and add a light source...