MAMEWorld >> EmuChat
View all threads Index   Flat Mode Flat  

Reged: 04/11/16
Posts: 246
Send PM
The Search for a Better Bloom Filter
11/28/17 08:30 AM

My apologies for the large images, but I feel they are necessary.

I've gotten a chance to get back into working on HLSL modifications for MAME (which are also in the progress of getting ported to BGFX). Many of the changes are minor and uninteresting to most people. The change I'm going to discuss, however, I think is a little more interesting.

I find the current bloom filter in HLSL to be more than adequate. It is a fast and clever solution that produces great results. It works by adding seven additional layers, each more blurred than the prior. However, there are two primary issues the shader has for me. First (the only one I will discuss) I do not feel it represents its namesake. It is more of a 'glow' shader than a 'bloom' shader in my opinion. This idea stems from a confusion of terminology in the CRT world. 'Bloom' is a common term in 3D graphics for shaders that simulate glows of light sources, but in a CRT, bloom actually has nothing to do with the glow of a CRT (that is a different phenomenon). Bloom refers to a non-linearity in the power supply of the electron gun which results in a larger display of bright images or 'bloom'. It's useless to try to show an image of the phenomenon, unfortunately, but if you do have the chance to use a CRT monitor, you can alternate between a dark gray square upon a black background with a white square upon a black background. You will see the effect this way, though the amount of bloom there is depends on the quality of the monitor. Higher quality CRTs have less bloom.

Now a glow shader is certainly needed in HLSL and for that reason the current shader is quite valuable. In fact, even with my additions it may very well be necessary to keep this shader for the purpose of adding some glow to the final image, for those that like the look of it.

Let's take a look at a sample of the old bloom shader.

Now the new shader I am working on is not ready yet, so I've prepared a mockup. I will discuss the workings of this shader in brief. This shader uses only a single additional texture. A gamma function is applied to emphasize bright areas. A gamma of 3 or 4 seems to work well, but this will likely be parameterized. An edge-detection filter is applied. I am experimenting with this and will not say what it is. The filter blurs the edges a bit to soften the bloom a bit. Finally the texture is 'screened' back onto the original image. Screening is similar to addition, but it provides a softer look and doesn't affect the brightness of the image as much.

Here's a mock-up of the new shader. It's a tad subtle, but that's intended. This shader doesn't want to introduce a glow like the old bloom does. Rather it attempts to boost the bright parts of the image while not affecting the other parts.

I'd love to hear thoughts on this, whether you prefer the old or proposed, or say how these two compare with what other CRT shaders are doing. (I don't look at them. I have no idea if they have already accomplished this.) Don't expect it to be finished anytime soon either.

Edited by anikom15 (11/28/17 08:32 AM)

Entire thread
Subject Posted by Posted on
* The Search for a Better Bloom Filter anikom15 11/28/17 08:30 AM

Extra information Permissions
Moderator:  redk9258, URherenow, Tafoid 
0 registered and 15 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 418