10 September 2016

Getting a Video Retro Effect on LCD - BGFX, GLSL or Artwork Effect (Update September 2016)

Consider tweaking your screen output as soon as possible 

Since MAME focuses on exact emulation, the unmodified output is unsuitable for flatscreens. This means that the tube screen feeling must be emulated on top.

Raw MAME Output without tweaking:
Let's face it: This is ugly.

Understand the meaning of these Buzz Words:
  • Shader: program parts in MAME that can be activated for tweaking the Raw MAME output
  • Backends: sub-sections of a shader that chosen once a shader is activated 
  • OpenGL Shader - GLSL: for a long time the most important shader for Mac systems, still the performance king, but not part of the standard package
  • BGFX Shader: the new kid on the block, designed for cross-platform experience, official part of MAME
  • HLSL Shader: the shader in the Windows environment - don't mix this up with HLSL Backends within GLSL or BGFX - which apparently try to emulate the HLSL Shader in Mac systems
Recommendations summarized:
  • MAME STANDARD: bilinear filtering - just comes out of the box and gets rid of the worst pixel effects
  • ALTERNATIVE 1: If your machine is powerful enough, go for BGFX with the CRT-GEOM Deluxe Backend (new instructions below)
  • ALTERNATIVE 2: If this does not work out, go for GLSL with the CRT-GEOM Deluxe Backend instead (new instructions below)
  • ALTERNATIVE 3: If this does not work out, just add an Artwork Effect or - better - head for a new Mac
Here are the details for all three options - complete re-write in September 2016.

 Note: Below screenshots hardly demonstrate the real effect of tweaking. On my large 27'' iMac screen, the experience of a tweaked display is extreme. It immediately feels like playing on an Arcade machine. This rocks.

MAME Standard: Bilinear Filtering (explained here)
Pros: nothing to configure, gets rid of the worst pixels, good performance on weak machines
Cons: not that much retro feeling, nothing to tweak
Nutshell: for the lazy guy...all others go ahead!

[comparable screenshot to follow]

ALTERNATIVE 1: Adding a BGFX Shader
Pros: cross platform, good performance of  the CRT-GEOM Halation backend, same quality as GLSL, in-game sliders, within MAME Package and there updated with each MAME release, so obviously the future
Cons: still early development with inconsistent performance, in overall very demanding on performance
Nutshell: if your machine can handle it, go for it

Recommendation: CRT-GEOM-Deluxe
BGFX provides for tons of (partly experimental shaders), but since MAME 0.176, the CRT-GEOM-Deluxe shader also made it into the default package. I highly recommend this shader because it provides for a very decent effect but is performing quite well at the same time. By contrast, the HLSL shaders in BGFX tested before are far too demanding - look for this post for an in-depth look into the HSLS Backend of BGFX.

Since MAME 0.176, no additional download is required.

Configuration in QMC2 (Tools-Options...-Emulator):
  • Video/video/bgfx (force MAME into BGFX)
  • Video/window/enabled (optional, but recommended to switch to Window mode instead of full screen)
  • The BGFX Options are now very straight-forward to configure (note that since MAME 0.177, the Metal Backend seems to be broken, so again OpenGL as Backend):
Click to enlarge
Modifying the Preferences:
You need a text editor such as Text Wrangler. Modifying the preferences is as straight-forward as in the OpenGL Shader.

Locate (Mame Directory)/bgfx/chains/crt-geom-deluxe.json and open this file in your editor. Here the options are called 'Sliders' because you can change these options via Sliders within Mame. Your target in these sliders is the Default value, so forget about the Min and Max values.

In order to get a nearly identical result to the OpenGL Shader, I changed these default settings:

  • Halation amplitude: 0.05 (instead of 0.1)
  • Radius of curvature: 2.0 (instead of 3.5)
  • Distance to screen: 3.0 (instead of 2.0)
  • Gamma of simulated CRT: 2.2 (instead of 2.4)
  • Gamma of output display: 2.0 (instead of 2.2)

And here is the result - my current default display shader:

Click to enlarge
In MAME, by pressing the TAB key, you can move to the Slider Controls, and if everything worked out correctly, you find the changed default options of the shader in full detail:

Click to enlarge
Of course you can now change these values in the game with the arrow buttons, and this is where the BGFX shaders really shine in comparison to the OpenGL shaders.

ALTERNATIVE 2: Adding an OpenGL Shader
Pros: performance king, same quality as BGFX, if not higher quality
Cons: not in the default MAME package, more to configure, no in-game sliders, development unknown
Nutshell: still top performance, but unclear future

After tons of research and numerous fails, I finally managed to have things in place. Take a look by yourself.

Result 1 (without monitor curvature):

Click picture to enlarge

Result 2 (with curved monitor edges and overscan, VERY retro):

Click picture to enlarge

Recommendation: CRT-GEOM-Deluxe
Newest version is on this website: https://sites.google.com/site/o0kinghanco0o/crt-geom-alternative-downloads
Download this file: CGWG-CRT-geom-halation-20151123.zip
Further resource worth reading: http://www.mameau.com/mame-glsl-shaders-setup/ (with old shader version)

Configuration in QMC2 (Tools-Options...-Emulator):
  • Video/video/opengl (force MAME into OpenGL mode)
  • Video/window/enabled (optional, but recommended to switch to Window mode instead of full screen)
  • Video/effect/none (just checking that no png artwork from the first option is in place)
  • OpenGL/filter/enabled (default, just checking)
  • OpenGL/prescale/1 (default, just checking)
  • OpenGL/gl-glsl/enabled
  • OpenGL/gl_glsl_filter/1
  • OpenGL/glsl_shader_mame0/complete path to the shader you want to use
Locate the shaders in your directory (all ending with .vsh):
We need these three files (click to enlarge)
In this new version, all three shaders must be configured simultaneously: First Gaussx.vsh, then Gaussy.vsh, finally CRT-geom-halation.vsh.

This is the easiest way to produce a complete path of your shaders: Open an empty Terminal window and drag Gaussx.vsh into it -> you get the complete path, and you can copy/paste it.

Dragging the file into the Terminal window produces the full path for the QMC2 options.
After configuring QMC2 with all three shaders, your QMC2 OpenGL Options should look like this:
click to enlarge

Huge catch: You have to delete .vsh, otherwise it does not work!

This is how CRT-GEOM-DELUXE looks with default settings:

Modifying the Script Preferences:

The preferences in CRT-geom.vsh are straight forward. You need a script editor, e.g. Text Wrangler, TextEdit does not work (for me) and can modify the parameters.

Please refer to this Post for tweaking the settings in the way I like them. You also find a screenshot there.

You can find very detailed instructions on these parameters here:

ALTERNATIVE 3 - Adding an Artwork Effect
Pro: very easy
Con: very average quality
Nutshell: only recommended if neither GLSL nor BGFX perform decently
Click picture to enlarge


Download this tiny PNG called effect_cools.png from here. Save it to the artwork subdirectory of your MAME executable file (there are other effects as well, pre-installed by the MAME Team, but I still like that one most).
QMC2: Tools/Options/Emulator/Global Configuration/Video/effect
Default is none - point to the effect_cools.png on your drive as shown in this screenshot:
Click picture to enlarge

Remarks: I quite like this effect (I found this png in some MAME forum), and it is better than the artwork provided by the MAME Team (aperture-grill.png, monocrhome-matrix.png, shadow-mask.png, slot-mask.png, and white.png). But it is blurry. Do this only if your machine can neither cope with GLSL nor BGFX, it is just not the same quality.


  1. Hey Estefan nice tips here, thank you! Let me ask you how did you set the bezel (overlay) into elevator Action thru QMC2? Sorry if this is a dumb question but I'm newbie to all of this stuff, I already get the png file, but cant find out how to set it correctly. Thank you again!

  2. Hi Luciano, my pleasure :-): I updated my posting 'basic setup' of QMC2 with the Artwork section, which I wanted to do anyways. So please have a look, I hope that you will succeed. I also included screenshots taken with my iPhone on the differences between full artwork and cropped artwork. And: This is no dumb question at all :-).

  3. Curious why you recommend using Window mode?

    1. If you look into my Artwork settings in QMC2, a fixed window mode results in more cropped Artwork. It also gets you out easier, if something goes entirely wrong :-)

    2. Any chance you can post a screenshot comparison?
      I don't seem to see much difference, but it could be game specific.

    3. http://mameonmacs.blogspot.co.at/2016/01/basic-setup-of-mame-and-qmc2.html - first screenshot is fullscreen, the second one is window with fixed sizes - you see more from the cropped bezel

  4. Do you know what the difference between the glsl_shader_mame0 and glsl_shader_screen0 sections?
    I haven't found any info on what the difference is or means.

    1. I found some info here: http://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=100988#Post100988

      Seems glsl_shader_mame works at the game resolution and glsl_shader_screen works at the screen resolution.

  5. I am unsure about that, but I assume that the sreen section would allow you to apply different shaders to different screens (in a multi-screen environment). I did not yet find out a viable use - because even in a multi-screen game such as Darius, you would not want to apply different shaders to the different screens.

  6. Really this website gonna like by Youngster, Always old is gold checkout this arcademaverick Games
    arcade machines for sale


Any comments are welcome!