Jump to content
LaunchBox Community Forums

Mame BGFX Shaders - Tutorial


Lordmonkus

Recommended Posts

I struggled to get bgfx up and running, but finally got it to apply and am mostly happy with how it looks now using crt-geom-deluxe.  I still have a couple questions though.

1. I think the image still looks a bit too sharp.  Any way to blur crt-geom-deluxe similar to how HLSL has the defocus settings?  I want the pixel shading to blend a bit better.

2. I have my tilt set to 0.00,-0.08 to tilt the screen away from me slightly on the vertical axis.  However, when playing a vertically orientated game the tilt gets rotated so the screen is now titled horizontally and looks a bit skewed.  I really like the tilt for horizontal games, so is there a way to either have crt-geom-deluxe correctly keep the tilt at 0.00,-0.08 instead of -0.08,0.00  or to have separate settings for vertical games?  I looked into vertical.ini a bit, but it doesn't look like you can store settings in there since those all come from the .json.

Link to comment
Share on other sites

I was thinking about that some more and thought I came up with a workaround.  I realized I could just copy an existing shader, rename it, and reconfigure it to my liking.  So I took crt-geom-deluxe and made a copy named crt-geom-deluxe-vertical and then edited the json to have the correct tilt value correcting for rotation.  I copied raster.ini and named it vertical.ini and changed the shader value in it to my new vertical one.

Mame still wasn't using my vertical.ini for vertical games though.  I had to move my vertical.ini out of ini/presets to just ini to get it to take priority.

The new problem I ran into is that different games rotate different directions.  For example, Donkey Kong may rotate 90 degrees clockwise, but Pac-Man might rotate 90 degrees counter-clockwise.  That meant that even though my vertical.ini was being used, in some vertical games the screen would appear tilted towards me instead of away from me.  I couldn't find any way to compensate for that so I had to remove the tilt value for vertical games :(

I've been experimenting with BGFX's HLSL settings.  I'd like to use them due to the superior blur/defocus, but I get weird circular halos.  No idea what it causing it or how to correct it.

EDIT: Weird circular banding is coming from cubic and quadric distortion being applied to the shadowmask.  The image looks much better with both distortions turned off when using HLSL, but then you lose the appearance of the curvature of a CRT ?

Edited by Megahurtz
Link to comment
Share on other sites

  • 3 months later...

Sorry for dragging up a bit of an old thread.

I'm trying to get BGFX running on my MAME setup, but there is a huge amount of slowdown.

I was testing with the Popeye Revision D ROM - it's stutters and slows down to an unplayable level.

I'm running my MAME cab with the following:

  • Mame64 0.182
  • Core i3 @ 3.3Ghz
  • 4GB RAM
  • GeForce 210 Graphics card (Yes, I know it's not great)

I've tried some optimisations also, but no help - here's what I tried

throttle                  0
sleep                     0

artwork_crop              0
use_backdrops             0
use_overlays              0
use_bezels                0
use_cpanels               0
use_marquees              0

video                     bgfx

bgfx_screen_chains        crt-geom

Any ideas as to what's causing this ?

I know it's not a superfast setup, but I thought I should be able to have some screen effects !

Link to comment
Share on other sites

  • 2 months later...

Not that I am aware of but I am not a shader author / programmer.

Maybe there is a way to do it with lots of hand coding but I doubt there is an easy way to do it.

Personally I would just tweak the crap out of HLSL rather than try and convert to BGFX, that is what I have done since improvements to HLSL have made it better than BGFX instead of the other way around at the time I wrote this guide.

Link to comment
Share on other sites

Well it's about the easiest to get into because you can make changes while in game and see what happens on the fly, you just have to take note of the changes you like and then edit the raster.ini in notepad after, changes made in emulator do not save out automatically.

Derek Moore did a good getting started video.

 

Link to comment
Share on other sites

  • 8 months later...

I did this nearly two years ago and got it all to work. I have only now just updated to the latest MAME and tried to do this again but it will not create the mame.ini file. I just wanted to check if I am entering the command line correctly. This is what I am typing into command prompt:

C:\Users\Dane\LaunchBox\Emulators\MAME\Mame64.exe -cc

I am running command prompt as an administrator and made sure the folder MAME is in was not read only.

Link to comment
Share on other sites

28 minutes ago, Lordmonkus said:

I made a batch file to do it as well, just drop it in your Mame folder and double click it if you wanna try that. Also take a look in your Mame\ini folder, maybe there is one in there preventing a new one from being created.

Mame Ini Generator.bat 14 B · 0 downloads

I did check my ini folder and it was not there. Not to worry though because your batch file worked a treat. Thank you very much for that, much appreciated. Does it also work with MAMEUI64? I do not want to try it without asking in case it makes me computer explode or turn into a killer robot of some kind.

Link to comment
Share on other sites

6 hours ago, Lordmonkus said:

I can't say one way or the other, I do not use MAMEUI64 but I can say that the batch file will do nothing because the executable is named differently is it not ?

It is indeed. I edited the bat file and just replaced it with "Mameui64.exe" and it created an ini for Mameui64, thank you.

Edited by Dane
  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Hello. I want to use "crt-geom-deluxe" and I edit the mame.ini like this:

# OSD VIDEO OPTIONS
#
video                     bgfx

bgfx_screen_chains        crt-geom-deluxe

Still in MAME I don't see any change. Am I missing something?

Link to comment
Share on other sites

5 hours ago, virtuoso said:

Hello. I want to use "crt-geom-deluxe" and I edit the mame.ini like this:

# OSD VIDEO OPTIONS
#
video                     bgfx

bgfx_screen_chains        crt-geom-deluxe

Still in MAME I don't see any change. Am I missing something?

Is mame.ini in your ini folder or root directory? On the off chance it’s not in the root directory, place it there. Also check mame folder and files aren’t set to read only. I had this problem in the past but for the life of me I cannot recall how I rectified it though the read only was an issue with my RA at one stage so I thought I’d mention it.

Link to comment
Share on other sites

17 hours ago, flatuswalrus said:

Is mame.ini in your ini folder or root directory? On the off chance it’s not in the root directory, place it there. Also check mame folder and files aren’t set to read only. I had this problem in the past but for the life of me I cannot recall how I rectified it though the read only was an issue with my RA at one stage so I thought I’d mention it.

mame.ini is in the root folder and the files are not read-only (the whole MAME folder too).
Also MAME remembers the rom location I choose within the software, so it writes a config somewhere, but not in the mame.ini in the root foolder. Any idea where it could be?

EDIT: solved.

Edited by virtuoso
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...