• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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 45.2k 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.
  • C
    Cjax08 @ghogan42
    last edited by 13 Nov 2017, 23:09

    @ghogan42 @davej so I just tried out your crt shader last night and it’s pretty awesome. I have a few questions though. When I was using the crt-pi shader at 1080p I would have my pi overheat after playing a while. After I changed rendering to 720p I no longer had the issues. I think it was made for 1080p though so I’m not sure if it’s ideal. Is the Z-pi-crt shader made with 1080p in mind? And if so do you happen to know if it has any issues with increased heat over semi long play periods? I’m trying to decide whether to stick with crt-pi across the board or switch to yours.

    Also I saw on your libretto post that you were still working on the shaders for the snes mini. Are the shaders you have posted here the actual final most up to date versions?

    G 1 Reply Last reply 8 Jan 2018, 07:13 Reply Quote 0
    • G
      ghogan42 @Cjax08
      last edited by ghogan42 1 Aug 2018, 07:40 8 Jan 2018, 07:13

      Hello All, I spent quite a while getting versions of these shaders up and running on the SNES Classic. The gpu it has is a big downgrade from the Raspberry Pi 3. Then I got busy at work and haven't had time to come back to this.

      Here's how things stand now with the current version as of Jan 07, 2018 . The newest files are at the bottom of this post.

      1. I changed the names of the shaders to zfast_crt_standard, zfast_lcd_standard, zfast_crt_720p_SNES, zfast_crt_720p_PI3, zfast_lcd_720p. Hopefully they won't get confused with the crt-pi shaders.

      2. There were bugs in the horizontal scaling I used. It's now completely different. I've made a sharper version of the algorithm here: http://www.iquilezles.org/www/articles/texture/texture.htm that works well for scaling pixel graphics with a good tradeoff between blur/shimmer

      3. Most shaders now have RetroArch shader paramters that you can adjust. So if you don't like the defaults you no longer have to edit the files. Just go into the retroarch "Preview Shader Parameters" and edit them. Then you can save a preset with the options you like.

      Here's what the current versions look like. You won't see much difference, but under the hood things have changed.

      zfast_crt_standard: https://drive.google.com/file/d/12-auksKKlw0-78caUUYh2nX4rMgLArvf/view?usp=sharing
      zfast_crt_standard

      zfast_lcd_standard: https://drive.google.com/file/d/1pc3nZUeuQTGVvC2rPVFIWPnjlryqqSit/view?usp=sharing
      zfast_lcd_standard

      Here's some tips for setting the shaders up:

      1. You can drop all of the files in the zip file into any folder on your PI3. The GLSLP files and GLSL files go in the same folder. That's not how retropie usually does things, but it's how I did it.

      So either:
      \RETROPIE\configs\all\retroarch\shaders

      or:
      \RETROPIE\configs\all\retroarch\shaders\shaders

      should be fine for the location.

      1. You can load the shaders in retroarch with either "Load Shader Preset" and selecting the ".glslp" file OR by loading the shaders ".glsl" file
        directly. If you select the shader file directly then you should set the "Filter" to "Linear" and the "Scale" to "Don't Care".

      2. Three of the shaders should give correct output at 1080p or 720p: zfast_crt_standard, zfast_lcd_standard, zfast_lcd_720p. The 720p version of the lcd shader just has one pixel borders which the 1080p version can't replicate (it can only darken two pixels at a minimum). So you can use these at any resolution where they look good.

      3. There are two version of the 720p crt shader: zfast_crt_720p_SNES and zfast_crt_720p_PI3. The difference between them is that the SNES version is faster but requires you to manually ensure that you're getting 3x Integer Scaling on the vertical axis. That's what you SHOULD get at 720p from all of the old consoles with Intger Scaling set. However it turns out that many/most cores seem to lie about the resolution they produce! So you get non-integer scaling even when you turn on "Integer Scaling" in the Video Options!! So I made the zfast_crt_720p_PI3 version that tries to ensure integer scaling on it's own. It doesn't always center the image correcly though. I'm not sure why... The punchline is that if you're stuck running 720P and you see some artifacts in zfast_crt_standard then you probably want to try zfast_crt_720p_PI3 and not zfast_crt_720p_SNES.

      4. There is a "bonus" shader called sharp_quilez_gamma in the zip file. This is a modified "quilez" shader that is sharper than the default (but blurrier than nearest neighbor). It also does an approximate 2.45 to 2.2 gamma adjustment. It might be useful to people that want sharp-ish scaling without shimmering when things move.

      Answers to some questions that have come up:

      Q: Can you add curvature?
      A: Nope. I wrote these to be full speed at a full 1920x1080 or 1600x1200 on a rpi3 and fullspeed on an SNES Classic at 720p. They won't be if I added curvature.

      Q: Will these make my pi overheat?
      A: They shouldn't! My pi3 is an an case with a retrotink on top blocking air flow and I don't have problems. Make sure you have a heatsink on there though. And if your pi is only stable at 720p, well then, go ahead and use that.

      Newest Versions of the shaders as of January 07 2018:
      https://drive.google.com/file/d/1f4B1lzTRnjuYySh1iZazT_KlWY1Bj2Oc/view?usp=sharing

      R 1 Reply Last reply 8 Jan 2018, 08:11 Reply Quote 4
      • R
        Rion @ghogan42
        last edited by 8 Jan 2018, 08:11

        @ghogan42 Well this answer my question the other day over at libretro.

        Great job, love it!
        To bad about the curved option but I can understand why you cut it out.

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

        G 1 Reply Last reply 9 Jan 2018, 02:33 Reply Quote 0
        • G
          ghogan42 @Rion
          last edited by 9 Jan 2018, 02:33

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

          Great job, love it!
          To bad about the curved option but I can understand why you cut it out.

          Well maybe I can give curvature a shot. Here's a work in progress. It's way too slow right now though... But if I get anywhere I'll post it here.

          zfast_crt_curve: https://drive.google.com/open?id=1uusySOl0IkxMWDfybRfUaiPeLMV3evVT
          zfast_crt_curve

          G 1 Reply Last reply 10 Jan 2018, 02:30 Reply Quote 1
          • G
            ghogan42 @ghogan42
            last edited by ghogan42 1 Oct 2018, 02:44 10 Jan 2018, 02:30

            @ghogan42

            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
            zfast_crt_curve_fps

            R 1 Reply Last reply 10 Jan 2018, 07:38 Reply Quote 2
            • R
              Rion @ghogan42
              last edited by 10 Jan 2018, 07:38

              @ghogan42 Now I'm excited to see what you will come up with 😎

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

              1 Reply Last reply Reply Quote 0
              • C
                cosmo0
                last edited by 10 Jan 2018, 12:47

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

                madmodder123M G 2 Replies Last reply 11 Jan 2018, 01:47 Reply Quote 0
                • madmodder123M
                  madmodder123 @cosmo0
                  last edited by 11 Jan 2018, 01:47

                  @cosmo0 Nice, I like your overlay pack Thomas, it makes me happy :)

                  1 Reply Last reply Reply Quote 0
                  • B
                    Beldar
                    last edited by 13 Jan 2018, 17:13

                    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 13 Jan 2018, 22:39 Reply Quote 0
                    • G
                      ghogan42 @Beldar
                      last edited by 13 Jan 2018, 22:39

                      @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 16 Jan 2018, 09:51 Reply Quote 1
                      • G
                        ghogan42 @cosmo0
                        last edited by 13 Jan 2018, 22:45

                        @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 16 Jan 2018, 09:51

                          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

                          R ClydeC 2 Replies Last reply 19 Jan 2018, 00:20 Reply Quote 5
                          • strangerukS
                            strangeruk
                            last edited by 16 Jan 2018, 13:27

                            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
                            • C
                              cosmo0
                              last edited by 18 Jan 2018, 19:07

                              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
                              • R
                                Rion @ghogan42
                                last edited by Rion 19 Jan 2018, 00:20

                                @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 19 Jan 2018, 07:14 Reply Quote 0
                                • G
                                  ghogan42 @Rion
                                  last edited by ghogan42 19 Jan 2018, 07:14

                                  @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 22 Jan 2018, 07:46 Reply Quote 3
                                  • ClydeC
                                    Clyde @ghogan42
                                    last edited by Clyde 19 Jan 2018, 22:20

                                    @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 22 Jan 2018, 07:46

                                      @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 23 Jan 2018, 03:51 Reply Quote 0
                                      • G
                                        ghogan42 @caver01
                                        last edited by 23 Jan 2018, 03:51

                                        @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 23 Jan 2018, 17:04 Reply Quote 1
                                        • coldnpaleC
                                          coldnpale
                                          last edited by coldnpale 23 Jan 2018, 11:53

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

                                            [[user:consent.lead]]
                                            [[user:consent.not_received]]