Jump to content
LaunchBox Community Forums

Mame BGFX Shaders - Tutorial


Lordmonkus

Recommended Posts

The guide is still perfectly valid, nothing is changed on how to use it.

2 hours ago, ItchyRobot said:

sn't this a huge downside, and deal breaker? It seems that if I have to set up each game before playing, it just would not be worth it.

You don't have to set BGFX per game, all what I said was you cannot easily tweak the look of BGFX, you take what you get from the presets and you either like it or you don't.

2 hours ago, ItchyRobot said:

Do you have a preference over one or the other, HLSL/BGFX, now that both have evolved?

I prefer HLSL myself and I have uploaded my settings here:

 

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

To be honest I totally didn't reread the 1st post and this is the exact guide I used to get BGFX to work once I had it set I didn't really need to make changes to it. So I kind of misunderstood and probably shouldn't have commented at all.

Link to comment
Share on other sites

I’ve been running BGFX with crt-geom as of 0.193 with satisfactory results.  I used the guide in this thread to help me get it started and noted the settings I liked while updating live and then making the changes permanent in the mame.ini settings. 

Upside - I think it looks great adjusted a bit so it doesn’t appear as “round” and the fact you don’t need AS heavy CPU/GPU requirements to run it. 

Downside - it STILL requires some horsepower!!! As an example, I’m running a GTX 730 due to the single slot requirement because of my SFF form factor, and an intel i7 4th gen, and HLSL will not run 64th Street Detective without sound stutter. With BGFX, it runs perfect and looks great. 

I use that game as a reference, but neither will run Asteoids Deluxe with the artwork overlay. 

Any similar observations? 

Link to comment
Share on other sites

The -video d3d version of HLSL reads values from either the mame.ini or specific ini files in location ini and/or ini/presets

The advantage of HLSL using BGFX is you can switch effects in real-time while the emulation is running with TAB/Slider Controls/ Window 0, Screen 0 effect. Also, to change values you must edit the appropriate .json file in location MAME\bgfx\chains

The advantage to this is you can have hundreds of .json files and it wouldn't matter what the names of them are. You can switch files in real-time using MAME's internal menu which you can't do with d3d HLSL.

Link to comment
Share on other sites

  • 2 months later...
On 12/22/2017 at 9:26 PM, Lordmonkus said:

BGFX shaders are not very flexible to the end user since they are basically hard coded in the .json files.

At the time when I did this guide HLSL was a total mess and BGFX was the superior shader with less hassle but since then HLSL has undergone a massive improvement and is much better and easier to tweak to your liking. I would suggest looking into those. I posted my presets here:

You can preview changes using the ` menu but to make them permanent simply edit the raster.ini file in the \ini\presets folder.

Hi, im using your preset (thanks), is very nice BUT there is a sliding effect when, in cps1/2 and neogeo games i move up and down and there is parallax backgrounds, there is like vsync issues, like waves in the scanlines at some points... is "normal"? in cadillac and dinosaurs maybe i remember a similar, or the same effect, in the original cabinet, lol, but maybe is my memory who play me! :D

Link to comment
Share on other sites

Not sure exactly what you are referring to though it may well be a v-sync issue since that can play with certain effects in games such as shadows in Samurai Shodown. I play on a G-Sync display with v-sync off so my games run at their native refresh rates and I don't notice anything weird or out of place.

  • Like 1
Link to comment
Share on other sites

5 minutes ago, Lordmonkus said:

Not sure exactly what you are referring to though it may well be a v-sync issue since that can play with certain effects in games such as shadows in Samurai Shodown. I play on a G-Sync display with v-sync off so my games run at their native refresh rates and I don't notice anything weird or out of place.

 

yes, i tried to activate v-sync in mame option (as default was off), video section, and seems to dont render anymore the tearing/wave effect...

Link to comment
Share on other sites

  • 1 month later...

Guys, I'm trying to change my hlsl settings but Mame doesn't seem to use them. For example I want my corners rounded but when I play the corners are square! Below is my mame.ini settings I'm using with mame 0.200 no nag. What do you think?

#
# CORE CONFIGURATION OPTIONS
#
readconfig                1
writeconfig               0

#
# CORE SEARCH PATH OPTIONS
#
homepath                  .
rompath                   "D:\Arcade\MAME 0.196 CHDs (merged);D:\Arcade\MAME 0.200 ROMs (split)"
hashpath                  hash
samplepath                samples
artpath                   artwork
ctrlrpath                 ctrlr
inipath                   .;ini;ini/presets
fontpath                  .
cheatpath                 cheat
crosshairpath             crosshair
pluginspath               plugins
languagepath              language
swpath                    software

#
# CORE OUTPUT DIRECTORY OPTIONS
#
cfg_directory             cfg
nvram_directory           nvram
input_directory           inp
state_directory           sta
snapshot_directory        snap
diff_directory            diff
comment_directory         comments

#
# CORE STATE/PLAYBACK OPTIONS
#
state                     
autosave                  0
rewind                    0
rewind_capacity           100
playback                  
record                    
record_timecode           0
exit_after_playback       0
mngwrite                  
aviwrite                  
wavwrite                  
snapname                  %g/%i
snapsize                  auto
snapview                  internal
snapbilinear              1
statename                 %g
burnin                    0

#
# CORE PERFORMANCE OPTIONS
#
autoframeskip             0
frameskip                 0
seconds_to_run            0
throttle                  1
sleep                     1
speed                     1.0
refreshspeed              0

#
# CORE RENDER OPTIONS
#
keepaspect                1
unevenstretch             1
unevenstretchx            0
unevenstretchy            0
autostretchxy             0
intoverscan               0
intscalex                 0
intscaley                 0

#
# CORE ROTATION OPTIONS
#
rotate                    1
ror                       0
rol                       0
autoror                   0
autorol                   0
flipx                     0
flipy                     0

#
# CORE ARTWORK OPTIONS
#
artwork_crop              0
use_backdrops             1
use_overlays              1
use_bezels                1
use_cpanels               1
use_marquees              1
fallback_artwork          
override_artwork          

#
# CORE SCREEN OPTIONS
#
brightness                1.0
contrast                  1.0
gamma                     1.0
pause_brightness          0.65
effect                    none

#
# CORE VECTOR OPTIONS
#
beam_width_min            1.0
beam_width_max            1.0
beam_intensity_weight     0
flicker                   0

#
# CORE SOUND OPTIONS
#
samplerate                48000
samples                   1
volume                    0

#
# CORE INPUT OPTIONS
#
coin_lockout              1
ctrlr                     
mouse                     0
joystick                  1
lightgun                  0
multikeyboard             0
multimouse                0
steadykey                 0
ui_active                 0
offscreen_reload          0
joystick_map              auto
joystick_deadzone         0.3
joystick_saturation       0.85
natural                   0
joystick_contradictory    0
coin_impulse              0

#
# CORE INPUT AUTOMATIC ENABLE OPTIONS
#
paddle_device             joystick
adstick_device            joystick
pedal_device              joystick
dial_device               mouse
trackball_device          mouse
lightgun_device           mouse
positional_device         joystick
mouse_device              mouse

#
# CORE DEBUGGING OPTIONS
#
verbose                   0
log                       0
oslog                     0
debug                     0
update_in_pause           0
debugscript               

#
# CORE COMM OPTIONS
#
comm_localhost            0.0.0.0
comm_localport            15112
comm_remotehost           127.0.0.1
comm_remoteport           15112
comm_framesync            0

#
# CORE MISC OPTIONS
#
drc                       1
drc_use_c                 0
drc_log_uml               0
drc_log_native            0
bios                      
cheat                     0
skip_gameinfo             1
uifont                    default
ui                        cabinet
ramsize                   
confirm_quit              0
ui_mouse                  1
language                  English
nvram_save                1

#
# SCRIPTING OPTIONS
#
autoboot_command          
autoboot_delay            0
autoboot_script           
console                   0
plugins                   1
plugin                    
noplugin                  

#
# HTTP SERVER OPTIONS
#
http                      0
http_port                 8080
http_root                 web

#
# OSD KEYBOARD MAPPING OPTIONS
#
uimodekey                 SCRLOCK

#
# OSD FONT OPTIONS
#
uifontprovider            auto

#
# OSD OUTPUT OPTIONS
#
output                    auto

#
# OSD INPUT OPTIONS
#
keyboardprovider          auto
mouseprovider             auto
lightgunprovider          auto
joystickprovider          auto

#
# OSD DEBUGGING OPTIONS
#
debugger                  auto
debugger_font             auto
debugger_font_size        0
watchdog                  0

#
# OSD PERFORMANCE OPTIONS
#
numprocessors             auto
bench                     0

#
# OSD VIDEO OPTIONS
#
#video                     bgfx
video                     d3d
numscreens                1
window                    0
maximize                  1
waitvsync                 1
syncrefresh               1
monitorprovider           auto

#
# OSD PER-WINDOW VIDEO OPTIONS
#
screen                    auto
aspect                    auto
resolution                auto
view                      auto
screen0                   auto
aspect0                   auto
resolution0               auto
view0                     auto
screen1                   auto
aspect1                   auto
resolution1               auto
view1                     auto
screen2                   auto
aspect2                   auto
resolution2               auto
view2                     auto
screen3                   auto
aspect3                   auto
resolution3               auto
view3                     auto

#
# OSD FULL SCREEN OPTIONS
#
switchres                 0

#
# OSD ACCELERATED VIDEO OPTIONS
#
filter                    1
prescale                  1

#
# OpenGL-SPECIFIC OPTIONS
#
gl_forcepow2texture       0
gl_notexturerect          0
gl_vbo                    1
gl_pbo                    1
gl_glsl                   0
gl_glsl_filter            1
glsl_shader_mame0         none
glsl_shader_mame1         none
glsl_shader_mame2         none
glsl_shader_mame3         none
glsl_shader_mame4         none
glsl_shader_mame5         none
glsl_shader_mame6         none
glsl_shader_mame7         none
glsl_shader_mame8         none
glsl_shader_mame9         none
glsl_shader_screen0       none
glsl_shader_screen1       none
glsl_shader_screen2       none
glsl_shader_screen3       none
glsl_shader_screen4       none
glsl_shader_screen5       none
glsl_shader_screen6       none
glsl_shader_screen7       none
glsl_shader_screen8       none
glsl_shader_screen9       none

#
# OSD SOUND OPTIONS
#
sound                     auto
audio_latency             2

#
# PORTAUDIO OPTIONS
#
pa_api                    none
pa_device                 none
pa_latency                0

#
# BGFX POST-PROCESSING OPTIONS
#
bgfx_path                 bgfx
bgfx_backend              auto
bgfx_debug                0
bgfx_screen_chains        crt-geom
bgfx_shadow_mask          slot-mask.png
bgfx_avi_name             auto

#
# WINDOWS PERFORMANCE OPTIONS
#
priority                  0
profile                   0

#
# WINDOWS VIDEO OPTIONS
#
menu                      0

#
# DIRECT3D POST-PROCESSING OPTIONS
#
hlslpath                  hlsl
hlsl_enable               1
hlsl_oversampling         0
hlsl_write                auto
hlsl_snap_width           2048
hlsl_snap_height          1536
shadow_mask_tile_mode     0
shadow_mask_alpha         0.0
shadow_mask_texture       shadow-mask.png
shadow_mask_x_count       6
shadow_mask_y_count       4
shadow_mask_usize         0.1875
shadow_mask_vsize         0.20
shadow_mask_uoffset       0.0
shadow_mask_voffset       0.0
distortion                0.20
cubic_distortion          0.0
distort_corner            0.05
round_corner              0.5
smooth_border             0.0
reflection                0.0
vignetting                0.25
scanline_alpha            0.60
scanline_size             1.0
scanline_height           1.40
scanline_variation        1.0
scanline_bright_scale     1.0
scanline_bright_offset    0.0
scanline_jitter           0.0
hum_bar_alpha             0.0
defocus                   0.4,0.0
converge_x                0.0,0.0,0.0
converge_y                0.0,0.0,0.0
radial_converge_x         0.0,0.0,0.0
radial_converge_y         0.0,0.0,0.0
red_ratio                 1.0,0.0,0.0
grn_ratio                 0.0,1.0,0.0
blu_ratio                 0.0,0.0,1.0
saturation                1.2
offset                    0.0,0.0,0.0
scale                     1.0,1.0,1.0
power                     1.0,1.0,1.0
floor                     0.0,0.0,0.0
phosphor_life             0.0,0.0,0.0

#
# NTSC POST-PROCESSING OPTIONS
#
yiq_enable                0
yiq_jitter                0.0
yiq_cc                    3.57954545
yiq_a                     0.5
yiq_b                     0.5
yiq_o                     0.0
yiq_p                     1.0
yiq_n                     1.0
yiq_y                     6.0
yiq_i                     1.2
yiq_q                     0.6
yiq_scan_time             52.6
yiq_phase_count           2

#
# VECTOR POST-PROCESSING OPTIONS
#
vector_beam_smooth        0.0
vector_length_scale       0.5
vector_length_ratio       0.5

#
# BLOOM POST-PROCESSING OPTIONS
#
bloom_blend_mode          0
bloom_scale               0.190
bloom_overdrive           1.0,1.0,1.0
bloom_lvl0_weight         1.0
bloom_lvl1_weight         0.64
bloom_lvl2_weight         0.32
bloom_lvl3_weight         0.16
bloom_lvl4_weight         0.08
bloom_lvl5_weight         0.06
bloom_lvl6_weight         0.04
bloom_lvl7_weight         0.02
bloom_lvl8_weight         0.01

#
# FULL SCREEN OPTIONS
#
triplebuffer              0
full_screen_brightness    1.0
full_screen_contrast      1.0
full_screen_gamma         1.0

#
# INPUT DEVICE OPTIONS
#
global_inputs             0
dual_lightgun             0

 

Link to comment
Share on other sites

  • 2 weeks later...

Thank you, Lordmonkus for creating this thread.  It was very helpful for me to learn about BGFX while revisiting my MAME setup after a 5-year hiatus.

I am now very interested in BGFX, partly because of the presets but also because it plays nicer with CPWizard than D3D does.  However, I do like my HLSL setup, which copied from somebody in another forum.

Do anyone if is it possible to find each parameter of an old HLSL setup in the new BGFX HLSL in order to reproduce it exactly or are the two systems different?

Also, reading through the web and assuming that information is not outdated, it seems like vector shaders only work with old HLSL.  Is that still the case?  If not, I would also like to migrate the MAME default vector presets from the old HLSL to BGFX HLSL.

Regards.

Link to comment
Share on other sites

  • 1 month later...

Daim I just follow this guide to get my Mame looking better on big screen. Now I just read that HLSL is better? Is it better even on old computer, or should I stick to BGFX? My media center is an old Q6600, quad core from Intel..

I saw you shared your file, but is there any tutorial for HLSL?

I followed most of your mame guide LordMonkus, even downloaded a name set 0198 based on your all killer no filler.  Never managed to get mame working, but thanks to you after many years now my setup is working good and without any weird crappy games haha..

Link to comment
Share on other sites

17 minutes ago, Sayajiin said:

I saw you shared your file, but is there any tutorial for HLSL?

Applying HLSL is very simple, instructions for it are on my HLSL ini download.

18 minutes ago, Sayajiin said:

Now I just read that HLSL is better?

It's subjective but I prefer HLSL and how much more customization it has.

  • Like 1
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
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...