Multiple BloomFilters affecting different objects with different blur scales

Context

I’m trying to have two different scales of glow:

  • Windows etc - subtle glow
  • Energy Weapons - massive glow

By this I mean things like the BloomFilter#setBlurScale having different values (not just brighter blur, which can of course be done on a per object basis using the glow color or glow map).

As the FilterPostProcessor is ultimately a viewport based thing I considered adding an additional ViewPort and adding my high glow objects to that ViewPort’s root node. I wanted to still have occlusion between these two layers so I set to not clear the depth flag.

    ViewPort overlay = getApplication().getRenderManager().createMainView("overlay", getApplication().getCamera());
    overlay.setClearFlags(false,false,false); 
    overlay.attachScene(highGlowRoot);

But with this the entire highGlowRoot scene was rendered over the top of the main scene. This makes me think clearFlags_depth doesn’t do what I think it does (what I thought it did was control whether the new view port “started from scratch” for the depth buffer or started from the view port before’s depth buffer). I also read that the FilterPostProcessor zeros out the depth buffer anyway so perhaps this approach wouldn’t work even if my understanding was correct)

Question

Is there a way to have some geometries with one bloom blur scale and other geometries with a different bloom blur scale?

Note: usually I would do this by just setting different brightness.

I don’t know if you are doing PBR or regular JME Lighting… but you’d want an emission texture and/or color… and then crank the color brightness on one and not the other.

Unless you are tightly controlling the glow mode per object (yuck) then I don’t know how this could work. You’d have to somehow render each ‘bloom’ separately and then merge them back together.

Glow mode seems ok for highlighting a specific object… but otherwise, I think emissiion-style bloom makes more sense and looks better in the end. (You don’t end up with weird bright things that don’t bloom at all, for example.)

I’m using Object mode and each of my models has a glow map to determine its glow level

To give an example here is high bloom scale

Weapons look good, windows look weirdly over the top

Here is low bloom scale:

Windows look good, weapons look too subtle.

I could probably find a compromise between those 2, but for jump effect i want an even larger scale. Perhaps im misusing glow, to give a feel of gas like volume, belond literal glowing

Unless you are tightly controlling the glow mode per object (yuck) then I don’t know how this could work.

I think that is indeed what I’m trying to do. I’m using glow to represent things that are in universe light sources (even if they aren’t literally light sources)

And that’s would I would use emissive materials for.

With emission, you can set the colors well beyond length=1 and they will bloom “more”. Usually I can find a way to have some things super bright and others not.

(In fact, what finally made me break down and add emission to my block materials was so that my lanterns would glow properly while still being a normal color otherwise.)

It’s incredibly freeing to have both emissive textures and emissive colors (pretty sure PBR already provides this) and they are not hard to add to regular JME materials that don’t have them.

1 Like

Ooo, that is interesting. I guess i am using glow to do double duty currently; glowing and “this is self lit”. I was thinking “what i need is a hybrid between lit and unshaded materials” and it sounds like that is what emissive is.

I don’t use PBRLighting currently (for those geometries) but moving over was on my list of things to do anyway.

Thanks for the good suggestion!

Possibly I have misunderstood. I moved over to PBRLightingMaterial and started using EmissiveMap for things like windows. But they still glow (in object mode) the same way that “GlowMap” did in LightingMaterial.

I think I might need to fork PBRLightingMaterial to separate out “things that emit light” and “things that glow”. Although I can’t find where PBRLighting.frag is doing it. I can see that it is using emissive to update the gl_FragColor skipping over any lighting related stuff, but I can’t see where it is leaving that emissive value for BloomFilter to find later.

Edit: ah, I see PBRGlow.frag is included by PBRLighting.j3md. Maybe this will be easy, just redefine my own PBRGlow.frag and reuse all the rest

FWIW, my suggestion was to stop using object-level glow mode and just use proper emissive values for whole scene bloom.

I’ve never used object level glow mode for anything so I have no familiarity with that. I was always able to get the effect I wanted by using high emission values.

Edit: to me PBRGlow.frag is implying object glow and not regular bloom.

emissionmap

This effect shown in the image is done with emissive mapping. It is basically adding some color independently of the lighting. of course it is only able to apply the aura glow to the model itself.

The aura effect you try to get on the laser shots. is usually done with postprocessing. Basically blur the hdr scene with a cutoff that ignores values below a threshold.

You can use any blur filter you want. here is a video explaying the “latest shit” by using some kind of fast fourier transform to get the desired effect.

here is a simple two pass gaussian blur shader for jme: illuminas/illuminas/src/main/resources/Shaders/Illuminas/Common/GaussianBlur.frag at master · zzuegg/illuminas · GitHub

4 Likes

By writing my own version of PBRGlow.frag I was indeed able to get the tight control of glow I wanted (with a separate GlowMap and EmissiveMap). Here the windows subtly glow and the weapon fire strongly glows

I may look into writing even more shaders to get even tighter glow control but I think that will do for now

(NB; in a frozen still the weapons fire looks weird being a cube, it looks a lot better in motion but it is still probably just a place holder for a better model)

3 Likes

Maybe someone needs to make an alternate screenshot tool that snaps three frames in a row and blends them.

People often tell me that Mythruna looks different (better) ‘in game’ than from screen shots. I know exactly what they mean but I still can’t put my finger on why… and it’s not as clear cut as motion blur in the case of your bullets.

Always an intriguing puzzle.

In mythruna it was the size of the visible world that i have never noticed on the screenshots.

The downside when using a separate glowmap is that you cannot have glow on objects that do not glow by themself. Like pointing hundreds of lights to a metallic object.