MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

"The Manuel"
Old Fart
Reged: 10/08/03
Posts: 244
Loc: Michigan, USA
Send PM


Migrating old hlsl setup from v0.151 to v0.202
#379152 - 10/27/18 08:03 AM


Ignore this first post. I'm now using the updated HLSL system and looking to migrate it to BGFX (see a couple of posts below)

I've been working on catching up my setup to the latest mame revision but HLSL has changed so much that my old parameters don't work correctly anymore.

My biggest problem at the moment is with the shadow mask. In my old setup, it blended with the scanline and created a CRT monitor effect that I really like. However, now it only changes the color of the image and is otherwise invisible so only scanlines are obvious. I slapped my old setup together from examples from people that knew what they were doing and tweaked a thing or two.

Can somebody help translate my old parameters to the new HLSL system?
I've added both below.

Finally, how do the old "curvature" and "pincushion" correlate with the new distortion, cubic distortion, distort corner, round corner, etc.?

Old HLSL code:


Code:

REMOVED



Edited by "The Manuel" (11/01/18 08:42 PM)



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: "The Manuel"]
#379168 - 10/27/18 09:55 PM


Look in the ini folder for examples.



"The Manuel"
Old Fart
Reged: 10/08/03
Posts: 244
Loc: Michigan, USA
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: "The Manuel"]
#379257 - 11/01/18 08:39 PM


Alright, I just moved on like everybody else and found a new set of HLSL parameters that I liked even more than my old one.

However, I learned about BGFX in the last couple of days and I'm exploring migrating to it, if anything because when I load CPWizard while playing a game, the display switches almost immediately between the game and CPWizard, whereas this happens quite slowly with d3d. Also, it is the direction the MAME team is going and the old HLSL will be left behind, eventually obsoleting my setup again.

In order to transfer my most recent, compatible HLSL raster setup to BGFX, I made a local copy of the BGFX hlsl.json file, found all the parameters from "regular" HLSL setup and changed them in that file. However, the resulting image was messed up. I traced the problem down to radial convergence and slot mask pixel count parameters.

The radial convergence was way off using the same numbers that I had in regular HLSL so it looks like perhaps BGFX uses a different sort of scale for these parameters than plain HLSL. The slot mask pixel count in my HLSL settings is negative for both x and y (I got it from a forum) and works perfectly fine but in BGFX HLSL it's not even inside the allowable range which doesn't include negative numbers.

Is there some decoder ring that will help me find equivalent values for these parameters between old HLSL and BGFX HLSL?

Also, is it possible to have a BGFX shader for vector games like the regular HLSL MAME vector.ini preset, which looks fantastic?



uman
MAME Fan
Reged: 04/15/12
Posts: 455
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: "The Manuel"]
#379268 - 11/02/18 01:59 PM


Hello,
BGFX is sadly still not the same like HLSL. It misses Bloom and it misses all relevant vector parameters. So while it is platform independent, BGFX also has its drawbacks.

Also, i wouldnt change any pixelcount parameters for any shadowmask, because the recommended ones, are already the best settings for them.

Without any of your own HLSL/BGFX settings posted here, it is way to hard to help you.



"The Manuel"
Old Fart
Reged: 10/08/03
Posts: 244
Loc: Michigan, USA
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: uman]
#379269 - 11/02/18 02:56 PM


Thanks for your reply, uman. I was starting to feel cold and lonely out here :-)

I tried some more last night and ended up basically giving up and concluding that there was no way to reproduce my HLSL setup on BGFX. I settled for adding more curvature, corner rounding and border smoothing to the crt-geom-deluxe shader which is pretty good in itself. What I could not do was to add vignetting to it. That parameter is not called out in the json file for that shader and just copying the vignette line from another shader to it doesn't make it work.

Is there a solution for that, at least?


For what it's worth, below is the HLSL ini code I was using for raster games.
I got it from the HyperSpin forums and made a few tweaks.

Code:

#
# DIRECT3D POST-PROCESSING OPTIONS
#
hlslpath hlsl
hlsl_enable 1
hlsl_oversampling 0
hlsl_write
hlsl_snap_width 2048
hlsl_snap_height 1536
shadow_mask_tile_mode 0
shadow_mask_alpha 0.45
shadow_mask_texture slot-mask.png
shadow_mask_x_count -3
shadow_mask_y_count -2
shadow_mask_usize 1.000000
shadow_mask_vsize 0.250000
shadow_mask_uoffset 0.0
shadow_mask_voffset 0.0
distortion 0.2
round_corner 0.20
# This effect is nice but tends to hide part of top/bottom of screen (0.05 is a compromise)
smooth_border 0.05
reflection 0.0
vignetting 0.20
scanline_alpha 0.5
scanline_size 1.0
scanline_height 1.0
scanline_variation 0.2
scanline_bright_scale 1.8
scanline_bright_offset 0.1
scanline_jitter 0.02
# Controls the line that sweeps the screen bottom to top in old monitors out of tune
# A value of 0.04 shows a noticeable realistic line
hum_bar_alpha 0.0
defocus 0.5,0.5
converge_x 0.0,0.0,0.0
converge_y 0.0,0.0,0.0
radial_converge_x 1.5,-1.5,-1.0
radial_converge_y 0.0,0.0,1.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.15
offset 0.0,0.0,0.0
scale 1.0,1.0,1.0
power 1.5,1.5,1.5
floor 0.0,0.0,0.0
phosphor_life 0.34,0.34,0.34

#
# 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_length_scale 0.5
vector_length_ratio 500.0

#
# BLOOM POST-PROCESSING OPTIONS
#
bloom_blend_mode 0
bloom_scale 0.65
bloom_overdrive 1.0,1.0,1.0
bloom_lvl0_weight 1.0
bloom_lvl1_weight 0.40
bloom_lvl2_weight 0.05
bloom_lvl3_weight 0.06
bloom_lvl4_weight 0.20
bloom_lvl5_weight 0.30
bloom_lvl6_weight 0.20
bloom_lvl7_weight 0.02
bloom_lvl8_weight 0.01




uman
MAME Fan
Reged: 04/15/12
Posts: 455
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: "The Manuel"]
#379281 - 11/02/18 06:59 PM


Sorry to say that, but you cant simply copy the vignette-fx from HLSL to another shader. The crt-geom-deluxe shader is a good "allrounder" in that way, that it nearly always looks the same on any raster-game, with superb results if used with low-end hardware. Especially if you dont use the deluxe version which just adds bloom (demanding a mid-range graphics card).

If you want proper settings for shadowmasks in HLSL, just look here:

https://docs.mamedev.org/advanced/hlsl.html

Those shadowmask settings are among the best you can have.

Your Hyperspin settings also have no good Bloom settings. Just look for the suggested defaults in bloomlevels for raster-based games in the link above.

If you ask me, HLSL has still the best options for creating nice CRT effects for any game, being it raster or vector or lcd.



"The Manuel"
Old Fart
Reged: 10/08/03
Posts: 244
Loc: Michigan, USA
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: uman]
#379285 - 11/02/18 08:17 PM


Thanks for the tips. I'll play around with the bloom settings some more.



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: "The Manuel"]
#379288 - 11/02/18 09:40 PM


> Alright, I just moved on like everybody else and found a new set of HLSL parameters
> that I liked even more than my old one.
>
> However, I learned about BGFX in the last couple of days and I'm exploring migrating
> to it, if anything because when I load CPWizard while playing a game, the display
> switches almost immediately between the game and CPWizard, whereas this happens quite
> slowly with d3d. Also, it is the direction the MAME team is going and the old HLSL
> will be left behind, eventually obsoleting my setup again.
>
> In order to transfer my most recent, compatible HLSL raster setup to BGFX, I made a
> local copy of the BGFX hlsl.json file, found all the parameters from "regular" HLSL
> setup and changed them in that file. However, the resulting image was messed up. I
> traced the problem down to radial convergence and slot mask pixel count parameters.
>
> The radial convergence was way off using the same numbers that I had in regular HLSL
> so it looks like perhaps BGFX uses a different sort of scale for these parameters
> than plain HLSL. The slot mask pixel count in my HLSL settings is negative for both x
> and y (I got it from a forum) and works perfectly fine but in BGFX HLSL it's not even
> inside the allowable range which doesn't include negative numbers.
>
> Is there some decoder ring that will help me find equivalent values for these
> parameters between old HLSL and BGFX HLSL?
>
> Also, is it possible to have a BGFX shader for vector games like the regular HLSL
> MAME vector.ini preset, which looks fantastic?

FWIW, lately I've been the only one adding new features to HLSL which are added to both the D3D and BGFX versions. I continue to use the D3D driver for performance reasons and I will continue to port new features (assuming I create any) to both D3D and BGFX unless it is somehow impossible to add to D3D. Right now BGFX doesn't save parameters and doesn't support presets which is a big issue. I'm not sure what MAMEDev's vision for BGFX presets is going forward, but I'm hoping that it will work seamlessly with the D3D INIs.



anikom15
Instigator/Local CRT Guru
Reged: 04/11/16
Posts: 287
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: "The Manuel"]
#379289 - 11/02/18 09:44 PM


> Thanks for your reply, uman. I was starting to feel cold and lonely out here :-)

I told you to look at the presets in the ini folder and you didn't give me any feedback. They have the exact parameters you need for getting the shadow masks working properly.



"The Manuel"
Old Fart
Reged: 10/08/03
Posts: 244
Loc: Michigan, USA
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: anikom15]
#379290 - 11/02/18 09:45 PM


Thanks for the info. I've come quite a long way along the path of BGFX but I've started to notice something that gives me pause. With BGFX, in order to avoid microstuttering when scrolling, I have to enable waitvsync. However, this introduces noticeable input lag, and not one to complain much about that (although I had the same issue with Demul recently.

With D3D I only enable triplebuffer and get no tear, stuttering or input lag. I'll need play some more with it and decide if I want to sacrifice responsiveness and shader flexibility just so that I can snap in and out of CPWizard quickly, which BGFX excels at but D3D creates a long pause for me.



"The Manuel"
Old Fart
Reged: 10/08/03
Posts: 244
Loc: Michigan, USA
Send PM


Re: Migrating old hlsl setup from v0.151 to v0.202 new [Re: anikom15]
#379291 - 11/02/18 09:47 PM


Remember that I was trying to translate from one system to another and initially I wasn't sure if just looking at examples would allow me to do that. I did eventually manage to cross-reference parameters but there is no equivalence as I posted later.

There doesn't seem to be a way to easily transfer my old set up to BGFX HLSL but I'm with crt-geom-deluxe with some modifications, if I stay with BGFX.


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

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