01 February 2019

BGFX really rocks and after some MAME Updates, it became my standard shader.Update January 2019: MAME 206 corrects the HLSL shader, so the purple screen is gone.The 'Scale' values as described below are now in lines 186 and 191. Now I need to head for the new phosphor settings and update the below table for HLSL settings (I still do not like the default settings that much). Below you find the updated table of my current HLSL settings plus the Scale values for the lines 186 and 191.Update December 2018: Since the October 2018 release, the HLSL shader has been updated by phosphor settings. As a result, BGFX/HLSL produces a purple picture, at least on my Mac in both MacOS and Linux - is this an SDL MAME problem? I am still investigating into that, and for the time being, I stay with BGFX/CRT-GEOM-Deluxe, which still provides very decent results.

HLSL under Windows (Bootcamp)

HLSL under MacOS and Ubuntu

Since both MacOS and Ubuntu is affected, this could point to an SLD problem.

Update December 2016:As explained by Jeeze in a comment to the Performance Test Post, the 'Scale' values in BGFX/HLSL provide for Oversampling. When it comes to modern games, this makes a real difference in quality, while I am unsure about any difference in old games.

CRT-GEOM - click to enlarge

Here are screenshots from Offroad Challenge for comparison. CRT-GEOM vs. HLSL vs. HLSL Oversampling
In the enlarged pictures, just look at the shadows to see the huge difference, but overall picture is much smoother. Photos taken by hand.

In the running game, the difference is even more pronounced.

HLSL - click to enlarge

HLSL Oversampling - click to enlarge

CRT-GEOM - click to enlarge

HLSL - click to enlarge

HLSL Oversampling - click to enlarge

So if you play modern games, you will probably want to leave the 'Scale' value to 2, as long as your machine is able to cope with it.

Update October 2016: Due to a much appreciated comment by Jeeze, the main issue for the HLSL performance seems to be a parameter outside of the preferences. As suggested, I went down with the 'Scale' values in lines 177 and 182 from 2 to 1, and this seems to push performance to CRT-GEOM levels. I could not see any difference in quality on first glance.I also adapted below tables a bit further and need to look further into this in more detail.Update September 2016: This post is about the settings of the HLSL Chain. But HLSL is very resource hungry, though it runs very nicely under my specs. As explained by visitor Headrush69, his iMac 2011 fails to run BGFX at an acceptable frame rate. Same applies to a MacBookPro 13'' Mid 2012, which fails to run any game properly under full framerate. Since MAME 0.176, CRT-GEOM Shader in BGFX is currently my first choice - see this new rewritten post.This is what you can do to change BGFX very conveniently to your own wishes - but with the example of the HLSL backend.

Step 3 - start editing the file with an editor of your choice; all relevant parameters are conveniently located at the top of the file beginning at line 58

The good news: All changes you apply here are the new default values when you open MAME - no manual changes of the Sliders necessary - this is perfect!

Here is my configuration that I really like - compared to the factory values as provided by MAME (changes marked in red) - version 29 May 2016 - outdated since the October 2018 releaseGet the modified file hlsl.json here.

My new HLSL settings as of January 2019:

Slider Name

Original Value

Modified value

Enable Adjustments

1

0

Enable NTSC

0

0

(all NTSC-related values unchanged for now)

all unchanged

Red Output from R,G,B

1.00, 0.00, 0.00

1.00, 0.00, 0.00

Green Output from R,G,B

0.00, 1.00, 0.00

0.00, 1.00, 0.00

Blue Output from R,G,B

0.00, 0.00, 1.00

0.00, 0.00, 1.00

Signal Offset,

0.00, 0.00, 0.00

0.00, 0.00, 0.00

Signal Scale,

0.95, 0.95, 0.95

0.95, 0.95, 0.95

Color Saturation

1,20

1,20

Red Linear Convergence, x and y

0.0, 0.0

0.0, 0.0

Green Linear Convergence, x and y

0.0, 0.0

0.0, 0.0

Blue Linear Convergence, x and y

0.0, 0.0

0.0, 0.0

Red Radial Convergence,

0.0, 0.0

0.0, 0.0

Green Radial Convergence,

0.0, 0.0

0.0, 0.0

Blue Radial Convergence,

0.0, 0.0

0.0, 0.0

Defocus

0.5, 0.5

1.0, 1.0

Scanline Amount

0.50

0.40

Overall Scanline Scale

1.00

1.00

Individual Scanline Scale

1.00

1.00

Scanline Variation

1.00

1.00

Scanline Brightness Scale

2.00

1.00

Scanline Brightness Offset

4.00

2.00

Scanline Jitter Amount

0.00

0.20

Scanline Variation

1.00

1.00

Shadow Mask Tile Mode

0

0

Shadow Mask Amount

0.50

0.40

Shadow Mask Pixel Count

12,12

12,12

Shadow Mask UV Size

0.500, 0.500

0.500, 0.500

Shadow Mask UV Offset

0.000, 0.000

0.000, 0.000

Hum Bar Amount

0.0

0.02

Hum Bar Frequency

0,001

0,001

Signal Floor

0.03, 0.03, 0.03

0.03, 0.03, 0.03

Signal Exponent

1.00, 1.00, 1.00

1.00, 1.00, 1.00

Color Mode

3

3

Chroma Conversion Gain

0.299, 0.587, 0.114

0.299, 0.587, 0.114

Phosphor A Chromaticity

0.630, 0.340

0.630, 0.340

Phosphor B Chromaticity

0.310, 0.595

0.310, 0.595

Phosphor C Chromaticity

0.155, 0.070

0.155, 0.070

Phosphor Gain

0.2124, 0.7011, 0.0866

0.2124, 0.7011, 0.0866

Phosphor Persistence,

0.45, 0.45, 0.45

0.50, 0.50, 0.50

Quadric Distortion Amount

0.05

0.05

Cubic Distortion Amount

0.00

0.10

Distorted Corner Amount

0.05

0.12

Rounded Corner Amount

0.05

0.05

Smooth Border Amount

0.03

0.03

Vignetting Amount

0.08

0.08

Reflection Amount

0.05

0.05

Scale (lines 186 and 191)

2

1

Some explanations regarding these changes:

First, this is all trial and error, not all values are self-explanatory and very much is a combination of everything.

Defocus seems an important change because otherwise the pictures get too pixelated

Many Scanline settings were too agressive and caused a lot of bleeding, also the screen did not have any real black, i.e. everything was too bright. Major change.

Signal Floor: The new version seems to have lowered this value to 0.03, which is importanat. That one was important for me because lowering these amounts brought more blacks into the picture. If you go down to zero, it's as black as in CRT-GEOM. But I appreciate this effect, but with a bit lower values.

New Phosphor Values: See above in orange. I did not mess around with them for the time being. But look into Color Mode - 2 gives you a very geeky Dicrome picture, which is nice from time to time.

Phosphor Persistence: lets the moving objects 'smear', which is nice, so I gave this a sightly higher value

Stephen yes it's distracting very much, but very often harsh reality back in good old times :-). Since BGFX seems to be very resource hungry (see my update above), may I ask you which machine you are using?

Headrush69 you were right, BGFX is very resource hungry. I updated this post with a warning, since even our MacBook Pro 13'' Mid 2012 failed to produce decent results. It has Intel HD 4000 Graphics inside. Otherwise Metal backend under El Capitan. It seems you need a strong GFX chip to run BGFX.

Hi Headrush69, vector games seem to play no effects in BGFX so far, which might be a configuration thing, have to look at it. What puzzles me more is that in Asteroids I suddenly see no shots, they're just gone. Must test further. Up to now no real performance issues, but BGFX is without doubt much more resource hungry. I do see some partial updates issues in Gyruss, need to do further testing. But all in all GLSL seems to be much more effective, probably time to look back into GLSL.

It is not a configuration thing. After some research I fond that BGFX and GLSL don't work with vector games. Currently only the D3D/HLSL combination work, which is Windows only.

I have the same issue with Asteroids, Star Castle, etc with almost invisible shots. The problem occurs when any filtering is used. This means using BGFX, using GLSL, even using the default OS X driver of OpenGL with bilinear or FF filtering.

It seems the only way (currently) is to switch to the "access" video driver.I then adjust the Brightness, Contrast, Gamma, and Flicker options to get the best look.