The Scanline Classic Shader

Thank you! You know, I feel like the phosphor effect was not this strong previously. I don’t know what’s going on :stuck_out_tongue: I will probably fix it internally.

The signal pipeline before CRT simulation is done in a weird resolution. I won’t get into why I do it this way, but I found that I needed to oversample by 2x to get the comb filter and PAL delay filter to work, but these are only used in two shaders. I can probably get a performance benefit by not oversampling the other shaders. I will be experimenting with that. The next release will have significant improvements for RF, but is more demanding. I am hoping that eliminating the oversample for the RF portion can reduce that impact.

2 Likes

I noticed in my shader that normal bilinear texture sampling (texture()) caused artifacts if I didn’t oversample significantly. When I look back 227.5 chroma periods for the comb filter, the point I am sampling is often in between samples and so needs to be interpolated. I was able to reduce the oversampling by using better interpolation (a Lanczos kernel). It’s a tradeoff: the interpolation is more expensive, but I need far fewer samples and that makes the other passes faster.

1 Like

I got a chance to try your shader again (from slang-shaders rather than your repo).

When I try uhd-4k-sdr/consumer/gen.slangp, I get an error:

[ERROR] [slang]: Unknown semantic found.
[ERROR] [slang]: Failed to reflect SPIR-V. Resource usage is inconsistent with expectations.

I think I’ve seen this error before when I reference a uniform or push constant that isn’t defined in the parameters. It looks like the issue might be in bezel-base.slang, but I don’t see anything obvious. I’m using Retroarch 1.19.0 (I know, kind of old) with Vulkan on Linux.

1 Like

This issue should be fixed in the next update. The Vulkan compiler is more strict than the D3D12 compiler. I switched to doing primary development on Vulkan for this reason, although D3D12 is what I use daily for RA because it seems to be more stable.

PC Engine is comming…

2 Likes

Version 6.2 is ready and will be in the shader pack soon. You can get it earlier below. With all major fourth generation consoles covered, and with the generic presets, I will be taking a short break. I will still work to fix any bugs if they come up, however. I’ll go back to working on presets in a week.

Version 6.2

  • More realistic RF simulation

  • Add specialized Mega Drive presets

  • Add PC Engine presets

  • Filter parameter values were tweaked and tap counts optimized for accuracy

  • Framing was resized to optimize performance; oversampling applied by composite shader pipelines as needed

  • A compiling issue with certain Mega Drive/Genesis presets on Vulkan was fixed

5 Likes

I still get some issues here, with Retroarch 1.22 (I updated), Linux, Vulkan, and AMD graphics. It loads but it looks like there is some alignment issue. I built the presets from your repository.

What preset and core are you using? What is your display resolution?

Do you get the same result with the RA shader download/ZIP release?

I’ve tried uhd-4k-sdr/consumer/gen.slangp (on BlastEm and Genesis Plus GX) and uhd-4k-sdr/consumer/snes-snesmini.slangp (on bsnes) with the same results. I’ve tried a native Retroarch install and the Flatpak as well. I’ve tried the ZIP release, built it from the repo, and the online updater. I have a 4k monitor.

I can send you a RenderDoc capture, if we have some method of sending 100MB+ files. It looks like the alignment split is in the second pass (frame.slang), at least for the gen.slangp preset.

Here’s what the output of frame.slang looks like, converted to a png.

I found an issue with the generic presets, but it looks like that’s unrelated. I can’t reproduce your bug, so this may be hardware dependent. Do you mind creating an issue on Github and uploading a log? You will need to enable both logging and the performance counters within the RA UI under the Logging menu.

I am guessing the output framebuffer of the frame shader is not the size being requested.

Version 6.2.1 with fixes for generic presets is available.

3 Likes

This is the 3DO. The 3DO always outputs 480i (with one exception, see below). Since the 3DO emulator doesn’t implement the system’s interpolation, I’ve attempted to replicate with simulated data. This interpolation shader, if successful, will be released separately. The missing data is estimated with a simple luminance edge detector. It ends up being very similar to the bilinear filter but is slightly sharper. I don’t even know if this game used the interpolator. Apparently games could disable the interpolator (outputting 480i via nearest neighbor) and the Japanese 3DO had a 240p mode available through a toggle switch (no scaling at all).

This screenshot has the deflicker enabled so that both fields can be seen at once. Picture was also increased a bit.

6 Likes

Another 3DO screenshot, this time composite, lower TVL.

2 Likes

3DO is pretty much finished and will be in the next update. I have also been able to get the shaders to be stable at all of the PSX’s many video modes. The Saturn has two separate video clocks however, which is a bit weird, so cannot work without some modifications to how timing is derived. The N64 should be trivial.

3 Likes

Do you plan on making 1080p presets in the future?

I have used the presets on 1920x1200 and they seem okay to me. Maybe some aliasing with the mask, but not too bad. Do you think dedicated 1080p presets would be useful?

1 Like

Hmm, I’m not an expert on CRT masks but I was intimidated by the folder names having tags like 4k uhd, and couldn’t tell if I’m getting the “intended” look or not.

Maybe instead of dedicated 1080p, an auto fit to resolution setting would be better?

I would start with trying out the presets on the resolution you want and see how it goes. If there are any issues or you think something looks off, let me know. I was thinking for 1080p, the presets would be nearly the same but use a lower TVL, maybe different mask diffusion. But I won’t be working on them for a while.

1 Like

The next update will be able to support shader subframes (for DOUBLE_REFRESH and phosphor). However, performance requirements are incredibly high, too high for my own system. Maybe a 4090 can run it :laughing:

4 Likes