New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.
-
Making moves! But..
I'm trying to figure out what tradeoffs I can make. Right now I've had to lose the sharpness slider and have it fixed to the sharpest setting. And we went from having different scanline beam profiles based on luminance to a constant beam width. And I've simplified the way the scanline/mask fades out as pixels get brighter.
So we're at 60fps but with caveats. The problem is that although we get 60fps most of the time, in some games/systems we drop below 60fps when the emulation gets heavy. This is because the rpi3 shares memory bandwidth between cpu/gpu I think. This is the problem I came across with crt-pi that motivated me to write the zfast shaders in the first place (my shaders get more than 60fps at 1440x1080 so I don't have to worry about drops). So I'm not really happy with the version with curvature yet and I need to think more about how to get a little more speed.
But we're getting there! And I thought it wouldn't be possible on rpi3 class hardware.
Here's my current progress with fps counter
zfast_crt_curve_fps: https://drive.google.com/open?id=15cWelo3aeQNIDqMsMemBJhVabiv2jmmG
-
@ghogan42 Now I'm excited to see what you will come up with 😎
-
Hi !
I love your shaders, and have included them in my overlays compilation pack : https://github.com/cosmo0/retropie-overlays
I hope you don't mind :)I had renamed them "ghogan-crt/lcd" but zfast is fine by me ;)
I am eagerly awaiting your curvature CRT shaders :)
-
@cosmo0 Nice, I like your overlay pack Thomas, it makes me happy :)
-
I tried these shaders out and I quite like them. With the limitations of the Pi, they might be the best scanline/gridding shaders possible. I am very thankful for the Raspberry Pi and also the Retropie community as it brought me back to retro gaming as my primary hobby.
I do wish that you had a version of your scanline shader that had a little stronger video smoothing or biliniar filtering. I think with scanlines and some slightly stronger blending you could achieve an approximation of analog signal distortion. It would go a long way in restoring transparency effects and color enhancement via dithering.
-
@beldar said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
I tried these shaders out and I quite like them. With the limitations of the Pi, they might be the best scanline/gridding shaders possible. I am very thankful for the Raspberry Pi and also the Retropie community as it brought me back to retro gaming as my primary hobby.
I do wish that you had a version of your scanline shader that had a little stronger video smoothing or biliniar filtering. I think with scanlines and some slightly stronger blending you could achieve an approximation of analog signal distortion. It would go a long way in restoring transparency effects and color enhancement via dithering.
Yeah I know what you mean. On the standard versions there is a parameter that ranges from 0 to 1. You get sharp scaling at 0 and pure bilinear at 1. Values in between get something in between. I have the default set pretty sharp (0.3? 0.4?) but you can change it and save the settings.
A problem I'm having now is that with the curvature calculations I can't afford the "inbetween" calculations and I'm stuck with full blurry or full sharp. I'm currently rewriting the whole shader to use look up tables in textures to hopefully make it run faster. If this doesn't work well enough, I'll post two versions of the curvature shader. One fully blurry and the other fully sharp. Either way, I'll have a version with curvature posted here by/on Monday.
-
@cosmo0 said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
Hi !
I love your shaders, and have included them in my overlays compilation pack : https://github.com/cosmo0/retropie-overlays
I hope you don't mind :)
I had renamed them "ghogan-crt/lcd" but zfast is fine by me ;)
I am eagerly awaiting your curvature CRT shaders :)I don't mind that at all. Making settings/configuration files/overly packs and things that "just work" takes a lot of effort. I tried to do the same for the snes classic and it was a pain. So it's a great service when people like you do these packs. There are a lot of people that can't do all of the configuration work on their own.
-
Well here is the best I could do right now for a version with curvature.
EDIT: The file was broken and also included unnecessary files. You probably need to re-download it.
NEW LINK: https://drive.google.com/file/d/1DqKVPccsnXBq5WFL7g4ncyvbatMOflWh/view?usp=sharing
Unfortunately, we lost some features to squeeze in curvature. You can't control the sharpness anymore. The shader loads a look up texture now that essentially tells it how to fix the texture coordinates. I wanted to load two LUT textures (sharp and blurry) and then give you a mix... but it was just too slow on the rpi3. We also don't have a variable scanline profile with pixel brightness anymore. And the mask doesn't fade out at higher brightness either. So we give up a lot. If you don't need curvature then I'd recommend you use zfast_crt_standard and not zfast_crt_curve.
However, we still have good texture filtering so we don't get much aliasing. Usually none.
It looks good I think! And it's pretty fast. at 1920x1080 (stretched to 16x9) it gets 47fps to 58fps depending on emulator load. This is a few fps faster than crt-pi still (which tops out at 54fps at this res). And it's much faster than crt-pi-curvature.
So we still get 60fps constantly at the normal 1440x1080 you get when emulating 4x3
aspect ratio systems.This version MUST be loaded by loading the zfast-crt-curve.glslp preset. Otherwise the shader won't know about the LUT textures it needs to load.
If you don't like the amount of curvature than check out the settings in the retroarch shader menu. You can control the shader and the curved corners independently.
I hope you this is useful for some of you.. Let me know if you have any problems with it!
zfast_crt_curve_fps: https://drive.google.com/open?id=1hSXRj0yYGth-dU4iZhdybY6yEuhNoQ3f
-
I have been using CRT-Pi for a while but thought I'd give this a try. I switched my Mega Drive emulation to 16:9 (not sure what people's views are on aspect rations for consoles?) as I wanted to test it out (been using core since setup) and applied zfast_crt_standard and fired up Streets of Rage 2. I have to say it looked and performed superbly! I have promptly switched all my CRT-Pi instances over to zfast!
Thanks @ghogan42 for investing the time in this, great result!
-
Oh my. It's so awesome ! Great looking, and so much faster than crt-pi-curvature !
I've updated my pack to use it on home consoles. I like speed, so I set them up in 720p, and it still looks great.
Thank you so much ! :)
-
-
@rion said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
ghogan42 Nice work! I don't know if it's my eyes or are the corners rounded off?
Because if that's the case this got me thinking about and old post i where i asked @davej about the same thing over at the libretro forums.
This was my question here
And this was @davej answer.Yeah the shader does rounded corners. Honestly I wouldn't have wasted the clock cycles for it, but with curvature method I'm using there was garbage on the edges of the screen I had to crop out anyway. So now we have rounded corners.
Also, the curvature and rounded corners have separate parameters to adjust, so you can get much rounder corners and/or curvature if you want it. I just set it where it looked close to my Sony pvm.
zfast_crt_curve_fps: https://drive.google.com/open?id=1vtYVhsXtx6tnxCf7-TWtHtv8UYVtMHoD
-
@ghogan42 Thank you very much for these fast shaders and especially for the curvature one. Since I got into Retropie some months ago, I missed the small but nicely rounded curvature Mame has on my PC. Retropie's crt-pi-curvature shader is too resource hungry and lacks round corners. Your curvature shader even lets me configure them!
My preferred settings are Curvature 0.01 and Corner 0.20, I like just a decent curvature instead of an in-your-face one. The missing options in comparison to your standard shader aren't much of a problem for me, the options of the curvature shader serve me well enough.
Just a little feedback in return.
-
@ghogan42 is there a way to set the corner and curvature values in the file itself (without using the rgui menu)?
-
@caver01 said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
@ghogan42 is there a way to set the corner and curvature values in the file itself (without using the rgui menu)?
Sure. You can just edit the glsl file. You just look for the lines that start out
#pragma parameter CURVE "curvature" 0.015 0.0 0.05 0.002,
#pragma parameter CORNER "corner" 1.0 0.0 5.0 0.2The default settings are the first number in the list of numbers at the end. The format for the numbers: DEFAULT MIN MAX STEPSIZE
So just change the first number in each list to your favorite setting and that's it. Also if you do change the glsl file, the new settings might not show up right away in retroarch. If that's the case you need to reload the glslp preset and then you should see your new defaults.
An alternative is to set the value in the gui and then go to "save core preset" (or whatever it is) in the shader menus to create a file with your settings just for an individual core.
I don't think I set the defaults very well for the curvature version. When i update the shader, I'll probably have different settings as defaults.
Hope this helps.
-
Hey everyone,
thumbs up for continuously improving shaders!
I just found out about your new shaders and wanted to ask, by using your shaders will I gain something as compared to the crt-pi shader? Better speed or compatibility with 1080p? On the other hand, do your shaders also trade something in return for the gains?At the moment I am using crt-pi on a 1080p screen resolution. Most of my games seem to run fullspeed except for some psx games.
Thanks a lot and sorry if this simple question got already answered somewhere that I missed (I tend to get lost when discussions get too technical).
-
@ghogan42 said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
if you do change the glsl file, the new settings might not show up right away in retroarch
Thanks for the tip. I was playing with that number and saw no difference. Can you tell me what triggers retroarch to notice the new values? Do I need to switch the shader to something and then back? Enable/disable shaders? Restart the Pi? I was editing the file over the network, making changes, saving, and launching a game with no changes. Exit game, edit file, save, relaunch. Clearly, this was not enough.
Thanks! The curvature looks great and I don't see any moire patterns on my initial tests so far. I don't know how you managed to pull that off!
-
@caver01 said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
Thanks for the tip. I was playing with that number and saw no difference. Can you tell me what triggers retroarch to notice the new values? Do I need to switch the shader to something and then back? Enable/disable shaders? Restart the Pi? I was editing the file over the network, making changes, saving, and launching a game with no changes. Exit game, edit file, save, relaunch. Clearly, this was not enough.
Thanks! The curvature looks great and I don't see any moire patterns on my initial tests so far. I don't know how you managed to pull that off!Either of the following should work to get your new settings:
- Use "Load Shader Preset"in the GUI and reload the preset file. That's the GLSLP file. Not the GLSL file
- Select a different shader in the GUI. Then select "Apply Settings". Then select the zfast_crt_curvature.glsl shader. Then select "Apply Settings" again.
The problem is that RetroArch likes to save it's own "glslp" files when you save settings and it writes the current parameter settings to those files. At that point retroarch doesn't even look in the glsl file anymore for the default settings because it's loading the ones it saved. And you won't see any indication in the UI that it's doing this either.
So if reloading the shader doesn't fix things, then you kind of have to hunt for rogue glslp files in the filesystem. You can probably wipe out any
"retroarch.glslp" that you find in subfolders of \RETROPIE\configs\all and any system specific ".glslp" files too. You'll only lose your saved shader settings if you do this and you should be back to a clean slate.As for moire, we're honestly just kind of lucky. The scanline profile is computed with soft transition. And the pixels are not sharp in the y direction (we use something like this: https://www.shadertoy.com/view/XsfGDn) and the curvature is not as prone to moire as proper/correct barrel distortion would be. So you see very little moire at 1080p. If you drop to 720p you get some though. But I'm pretty happy with the result as far as moire goes, for sure.
@coldnpale said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
Hey everyone,
thumbs up for continuously improving shaders!
I just found out about your new shaders and wanted to ask, by using your shaders will I gain something as compared to the crt-pi shader? Better speed or compatibility with 1080p? On the other hand, do your shaders also trade something in return for the gains?
At the moment I am using crt-pi on a 1080p screen resolution. Most of my games seem to run fullspeed except for some psx games.
Thanks a lot and sorry if this simple question got already answered somewhere that I missed (I tend to get lost when discussions get too technical).Hi, the reason these shaders exist is 100% because I started playing castlevania:sotn for the psx and got sound skipping in certain rooms at 1080p when it dropped below 60fps. So I wrote this shader aiming for 60fps at 1920x1080 (games stretched to the full 16x9 res) so that when I set it back to 4x3 (so the game is now actually 1440x1080 pixels) I would be completely free of slowdowns because of the extra headroom my shader has.
So the the punchline is: the standard versions of my shader is over 60fps at 1440x1080 so that psx should be at full speed (or at least it's not the shader's fault).
The curvature version is slower though. And is borderline 60fps at 1440x1080. But I can't do better at the moment. So it is what it is. Some people wanted it though. -
@ghogan42 said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
you kind of have to hunt for rogue glslp files in the filesystem.
Ok, a-hunting I will go. I am trying to do this WITHOUT using the RGUI. I don't really have an easy way to access it from my arcade cabinet build (hotkeys disabled, dedicated exit button, etc.).
-
@caver01 said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:
Ok, a-hunting I will go. I am trying to do this WITHOUT using the RGUI. I don't really have an easy way to access it from my arcade cabinet build (hotkeys disabled, dedicated exit button, etc.).
Oh I see. I guess a more foolproof way to do it would be to make a copy of the preset file (the glslp) with a different name. Then if you load that new preset retroarch will be forced to load your new settings because it will think it's looking at a new shader. But you still need to be able to load the new preset and not the old one. So if you're doing everything over the network you still could end up having to delete old glslp files or looking in the retroarch.cfg or other core .cfg to make sure it loads the preset you want it to. Retroarch config is little annoying once you've got a bunch of different configuration files around and you can't tell which one it's using!
Goof luck!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.