RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.

    Scheduled Pinned Locked Moved General Discussion and Gaming
    crtpixel shaderslcd
    75 Posts 26 Posters 47.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Beldar
      last edited by

      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.

      G 1 Reply Last reply Reply Quote 0
      • G
        ghogan42 @Beldar
        last edited by

        @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.

        G 1 Reply Last reply Reply Quote 1
        • G
          ghogan42 @cosmo0
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • G
            ghogan42 @ghogan42
            last edited by ghogan42

            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
            zfast_crt_curve_fps

            RionR ClydeC 2 Replies Last reply Reply Quote 5
            • strangerukS
              strangeruk
              last edited by

              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!

              1 Reply Last reply Reply Quote 0
              • cosmo0C
                cosmo0
                last edited by

                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 ! :)

                1 Reply Last reply Reply Quote 0
                • RionR
                  Rion @ghogan42
                  last edited by Rion

                  @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.

                  FBNeo rom filtering
                  Mame2003 Arcade Bezels
                  Fba Arcade Bezels
                  Fba NeoGeo Bezels

                  G 1 Reply Last reply Reply Quote 0
                  • G
                    ghogan42 @Rion
                    last edited by ghogan42

                    @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
                    zfast_crt_curve_fps

                    caver01C 1 Reply Last reply Reply Quote 3
                    • ClydeC
                      Clyde @ghogan42
                      last edited by Clyde

                      @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.

                      1 Reply Last reply Reply Quote 1
                      • caver01C
                        caver01 @ghogan42
                        last edited by

                        @ghogan42 is there a way to set the corner and curvature values in the file itself (without using the rgui menu)?

                        My 4-player cocktail style cabinet built as a custom "roadcase"

                        G 1 Reply Last reply Reply Quote 0
                        • G
                          ghogan42 @caver01
                          last edited by

                          @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.2

                          The 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.

                          caver01C 1 Reply Last reply Reply Quote 1
                          • coldnpaleC
                            coldnpale
                            last edited by coldnpale

                            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).

                            1 Reply Last reply Reply Quote 0
                            • caver01C
                              caver01 @ghogan42
                              last edited by

                              @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!

                              My 4-player cocktail style cabinet built as a custom "roadcase"

                              G 1 Reply Last reply Reply Quote 0
                              • G
                                ghogan42 @caver01
                                last edited by ghogan42

                                @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:

                                1. Use "Load Shader Preset"in the GUI and reload the preset file. That's the GLSLP file. Not the GLSL file
                                2. 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.

                                caver01C 1 Reply Last reply Reply Quote 1
                                • caver01C
                                  caver01 @ghogan42
                                  last edited by

                                  @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.).

                                  My 4-player cocktail style cabinet built as a custom "roadcase"

                                  G 1 Reply Last reply Reply Quote 0
                                  • G
                                    ghogan42 @caver01
                                    last edited by

                                    @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!

                                    1 Reply Last reply Reply Quote 1
                                    • dankcushionsD
                                      dankcushions Global Moderator
                                      last edited by

                                      @ghogan42 would it be possible for you to add these to the retropie shader repository on github? https://github.com/RetroPie/common-shaders/tree/rpi (rpi branch)

                                      that way, it will be included by default in retropie installations, and we can potentially start using them in the docs and scripts. if you want, i can add it for you, or talk you through adding them if you're new to git!

                                      G 1 Reply Last reply Reply Quote 1
                                      • G
                                        ghogan42 @dankcushions
                                        last edited by

                                        @dankcushions said in New CRT/LCD shaders for RPI3. They run at 60fps at higher resolutions and are configurable.:

                                        @ghogan42 would it be possible for you to add these to the retropie shader repository on github? https://github.com/RetroPie/common-shaders/tree/rpi (rpi branch)
                                        that way, it will be included by default in retropie installations, and we can potentially start using them in the docs and scripts. if you want, i can add it for you, or talk you through adding them if you're new to git!

                                        Sure. I looked at some instructions for git that covered forking/committing changes/filing pull requests and it seemed reasonable. So I can give it a try on Friday probably. I need to make a couple of changes to the shaders first anyway to clean up a couple of things.

                                        Is there some kind of preferred license that you guys prefer? I don't really care so if you wanted bsd or something instead of gpl then I could do that. Just whatever is convenient for you. Or if there are any project guidelines that I'd need to follow for the code. Although it seems like shader code is like the wild west as far as coding standards because so many shaders end up in every emulator under the sun.

                                        dankcushionsD 1 Reply Last reply Reply Quote 1
                                        • dankcushionsD
                                          dankcushions Global Moderator @ghogan42
                                          last edited by

                                          @ghogan42 i think it's all up to you! retropie-setup script license is here: https://github.com/RetroPie/RetroPie-Setup/blob/master/LICENSE.md (GPL i guess?)

                                          the crt-pi license is GPL: https://github.com/RetroPie/common-shaders/blob/rpi/shaders/crt-pi.glsl

                                          GPL would seem a safe bet.

                                          G 1 Reply Last reply Reply Quote 1
                                          • A
                                            AndrewH
                                            last edited by

                                            Hi, is there a 'vertical' version of the CRT shader, as there is for the current default crt-pi shader?

                                            I've read through the thread, but don't see any prior mention or discussion.

                                            G 1 Reply Last reply Reply Quote 2
                                            • First post
                                              Last post

                                            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.