Mega Bezel Reflection Shader! - Feedback and Updates

DOS batch for updating presets

Maybe this is helpful for one or another. I wrote a little batch file that updates my already created presets to the most recent version. HSM reflection is under heavy development, and every other day there’s a new version with great new features. Unfortunately, in most cases old presets are not compatible with the new version. The shader chain is different and the biggest problem: some parameters are being dropped and new ones added.

It’s a pain in the a… to either a) manually create your presets from scratch again or b) copy & paste every parameter into a newly created preset.

As of today I had already created ~ 30 presets. So I decided to write a small, helping dos batch which does a very simple job:

It creates a new shader preset file for all existing shader presets in the same directory and saves them into a newly created subfolder _new _\ .

The batch file inserts the new shader chain (first part of the preset), and then it appends all parameters from the old presets. For me this works pretty well.

Here’s how to use it:

  1. start retroarch
  2. load HSM’s new preset for the kind of shaders presets you want to update (i.e. “hsm-mega-bezel-reflection-crt-guest-dr-venom.slangp”)
  3. Apply changes. Retroarch automatically creates a new preset file with default parameters. You can find it here: [retroarch root]\shaders\retroarch.slangp
  4. Now create a new folder, for example “HSM Preset Update” on your desktop (or whereever you want)
  5. copy retroarch.slangp to this new folder and rename “retroarch.slangp” to “template.txt”
  6. now copy all your existing presets that are based on the same preset (in this example it’s “hsm-mega-bezel-reflection-crt-guest-dr-venom.slangp”) to the newly created “HSM Preset Update” directory (if you want to create updated files, of course)
  7. Now create a new txt file in the same directory and rename it to “HSM_preset_updater.bat”
  8. Copy the following code into that batch-file:

HSM_prest_update.bat:

@echo off
setlocal EnableDelayedExpansion
set template=template.txt
if exist _new_ (
	echo Folder _new_ already exists
	echo Please delete folder _new_ and restart updater. Thx.
	pause
	exit
)
mkdir _new_
for %%a in ("*.slangp") do (
	set shader=%%~na.slangp
	set new_shader=.\_new_\!shader!
	echo.>!new_shader!
	set params=false
	for /f "tokens=*" %%a in (%template%) do (
		set Line=%%a
		set Anfang=!Line:~0,10!
		if !params! EQU false echo !Line!>>!new_shader!
		if !Anfang! EQU parameters set params=true
	)
	for /f "tokens=*" %%a in (!shader!) do (
		set Line=%%a
		set Anfang=!Line:~0,10!
		if !params! EQU false echo !Line!>>!new_shader!
		if !Anfang! EQU parameters set params=false
	)
	echo !new_shader! created
)
pause

Now you can execute the batch file. It will create a subfolder called _new _ and will create an updated version of each file with the extension “slangp”. That’s it.

You can now use your newly generated, updated presets.

What else? Maybe you should know this:

  • If you had manually added shaders to the original presets chain, you have to add them to the new presets again manually, obviously. The chains change, so this cannot be automated. You have to do it by yourself
  • Some parameters from the old preset won’t exist in the new preset anymore, but still are copied by the batch to the new preset file. That’s no problem: they will be ignored, and the next time you apply changes or save your shader, they will automatically be eliminated.
  • Same for newly added parameters, that didn’t exist before: they will of course be missing in first place after the creation, but once you use the new preset, they will automatically be filled with the default values - and once you save or apply changes, they will show up in your preset file.

An remember, like always: use at your own risk :wink:

7 Likes

You are a star, will be using this for sure.

:vulcan_salute:

1 Like

Thx. I hope it will work for you. If not: just ask. I’m happy to help.

1 Like

Nice @frenki! thanks for your effort on this.

I’m hoping to start on a project soon which will get Retroarch to only save the changed parameters when you save in the UI, we’ll see how that goes :wink:

3 Likes

Nah, i mean the circles that look like rings in a tree stump.

1 Like

Hey! I have started a thread of my own for the graphics I am creating for this shader.

https://forums.libretro.com/t/duimon-hsm-reflection-shader-graphics-feedback-and-updates/28146

Links to the files and updates will be confined to that thread.

6 Likes

Nice! Feel free to cross link when you have cool updates (although I’m going to follow it myself anyway)

4 Likes

Hi, the moire artifacts you’re seeing could be because of a couple of issues, the latest release has some degradation of the screen image which will be fixed in the next update.

At that resolution I wouldn’t expect a lot of moire.

The base cause of the moire artifact is the curvature, if you set the curvature to 0 the moire should go away

1 Like

lol. Will do once I figure out how.

1 Like

Think you just copy the URL for the thread and paste it here, and copy this threads URL and paste it in your thread.

May be talking about something else but that’s how you link on here as far as I know.

Like so

And if you know which post number it is you can add it at the end of the URL with /(whatever#) and it’ll show that post in the box along with linking directly to it.

Like so:

1 Like

yer it comes and goes as i play with the integer scale to increase screen size. when i increase screen size the rings show, when decrease size they dissappear again.

1 Like

Which preset are you using? You could try the royale preset as royale handles the moire problem with curvature better than most.

Also in general moire artifacts are less of a problem when you are at an integer scale and using higher resolutions.

The effect you are seeing could be the CRT shader you are using rather than anything specific about the Mega Bezel, because the Mega Bezel uses already existing great CRT shaders which people really like rather than coming up with it’s own.


Edit for Clarity:

To test this:

  • Find what the resolution is for the portion of the screen displaying the tube by turning on the [SCREEN SCALE] Screen Scale Debug parameter which will show the resolution onscreen.
  • Set as a custom aspect resolution in the retroarch video settings
  • Load the standard shader, without the mega bezel, e.g. crt-guest-dr-venom.slangp

If the effect still appears then this is directly to do with the CRT shader and not something that can be fixed within the Mega Bezel.

1 Like

Hey there,

for some setups I like to have just a trinitron mask, without scanlines. I noticed that using easymode-halation allows to set “Scanline Type” to 3, which means there are no scanlines at all.

I then took a look into guest-dr-venom, where only scanline types from 0 to 2 only exist. So I “tweaked” the shader a little bit to allow scanline type 3. Now if you want to have an additional option to use the guest-dr-venom shader without scanlines, just do the following:

Open file “shaders\shaders_slang\crt\shaders\HyperspaceMadness\hsm-crt-guest-dr-venom-with-scaling.inc”

Replace the line containg this:

#pragma parameter gsl "Scanline Type" 0.0 0.0 2.0 1.0

by:

#pragma parameter gsl "Scanline Type" 0.0 0.0 3.0 1.0

And then replace:

if (gsl == 2.0) { w1 = sw2(f1,cref1,shape1); w2 = sw2(f2,cref2,shape2);}

by:

if (gsl == 2.0) { w1 = sw2(f1,cref1,shape1); w2 = sw2(f2,cref2,shape2);} else
    { w1 = vec3(f2); w2 = vec3(f1);}

That’s it. Now you can choose Scanline Type 3 whenever you don’t want to have scanlines.

Here’s an example with disabled scanlines:

@HyperspaceMadness: maybe you would like to consider implementing this small change into your master repo? It doesn’t do any harm (at least I guess), because it doesn’t need any additional parameter. It just adds an additional option. And if it’s part of “master” I wouldn’t have to apply these changes everytime there is a new version :yum:

But maybe there is a reason why Scanline Type 3 doesn’t exist by default?

I think you can do it with the last interlacing mode, and turning the interlacing trigger resolution down.

Cool nonetheless though.

1 Like

Oh, well :joy:

I happened to disable the interlace parameters in this shader because I didn’t know what they are good for :upside_down_face:

I needed “space” for some extra parameters, because I added your vignette function into this. Btw.: I made your vignette function customizable with 4 parameters and also added 2 different functions for 2 completely different kinds of leveling.

Oh, and I also added the light bulb reflection from the mame shader (you can see it on the screenshot) after you showed me how to disconnect shaders and integrate them. I even tweaked this one, so I can now set the exact x/y position of the light reflection on the screen. You opened a door for me, thx once again :+1:

1 Like

I’m glad I could be of help, and help open the door for you to start tinkering with shader code.

Screenshots looking nice btw.

1 Like

Yes this seems reasonable, we should also what @guest.r thinks about this and if he wants to add this to the standard guest-venom.

I’d enjoy seeing the code for the the vignette you guys made, I’m not happy with the vignette which is in there right now (taken directly from the mame shader)

I always enjoy that light bulb shader, it always makes me smile. It would be fun to put in, but I don’t think we can spare the number of parameters.

How do you find trying to put dirt/scratches on top of the screen with the image layering options available?

Also I’m thinking of renaming the OverlayImage to TopLayerImage to remove any confusion about retroarch overlays, what does everybody think about that?

3 Likes

Here’s the link to a set of shaders.

It needs some explanation, though.

I experienced severe problems with the most recent shader presets by HSM. It must have something to do with the intregration of the GTU passes and/or with resolution/scaling changes. When I use my modified venom-shader, it looks really ugly starting from HSM version April, 26th.

So as I “want to have it all” I did this: I created a set of all necessary shaders with HSM from 20th of April. I put them all in a seperate folder, called it “my_shaders” and put it in the top “shaders” directory. I created my own shader preset and modified all included links. Every neede shader and #include is below “my_shader”

shader\

my_shaders
presets
shaders_cg
shaders_glsl
shaders_slang

So now I can decide whether to use “bleeding edge” HSM shader or my customized shader.

About my customization: There are 4 “tweaks”:

  1. I integrated vignette into venom with 2 different gradients. As parameters are rare, I choose to do a little trick: If you set the Vignette Strength to a value BELOW zero, it uses another leveling function than if it is set to ABOVE zero. So I didn’t need an additional parameter :grin:
  2. I integrated light reflection and added some parameters
  3. I tweaked color-mangler, so the number of parameters (18 !!!) is reduced to only 1. This one parameter is just to choose a predefined color setup. Of course I will add more and more predefined color setup as I need them … btw. color-mangler is now part of my modified HSM shader preset
  4. And there’s another mame shader which became part of the preset: phosphor. Here I also reduced to number of parameters to 1 by integrating predefined phophor setups.

Now for my problem with the most recent version of HSM: the functions still work, but the resolution seems to be wrong, so transitions aren’t smooth anymore. Maybe we can find the reason, maybe with HSM’s help (he seems to be interested in what we are doing right now, I think :smile:)

Here’s the link:

1 Like

Oh. It wasn’t my purpose to write my last post in public. I thought I was in a private conversation with @Syh :roll_eyes:

Well, nvm. Now everyone can read it. There’s no secrets, so enjoy everybody. Maybe it’s useful for one or another :sweat_smile:

1 Like

Now I’m confused. Did I just PM you or is my answer in public conversation??

1 Like