The Scanline Classic Shader

I don’t see why a generic LUT shader couldn’t be used in place of the color output stage, so you could use your gamut thingy LUTs that way.

Well this is interesting … I may have accidentally discovered a way to easily make up lost brightness while maintaining gamma.

7 Likes

Can you provide details? I’m curious what this technique is. I basically blend in the unmasked scanlines starting when the the mask is fully saturated.

The mask is made with a series of Gaussian functions. Normally you are supposed to scale the output of a Gaussian by its integral because energy is supposed to be distributed across the function, but I just let it be free, so when you increase the sigma of these functions the mask dots blend into each other.

I then changed the User Picture and Brightness settings to operate on (virtual) luminance directly instead of voltage (and getting capped by the distortion modeler) so that I could pump values greater than 1.0 (to test my gamut compression algorithm). These two things essentially turned the CRT half of the pipeline into an HDR renderer. The zebra stripe mode I implemented allowed me to quickly scale the input without needing to measure. A tone mapper can give a little bit extra range but if it’s pushed too much the gamma will start to break down.

I then spent some time on math (I am not good at math). As long as you are working in a linear space and avoid exponentiating your input by itself it seems it should be possible to blend the image back to the original input level (at the expense of mask sharpness or whatever else you’re doing that cuts signal level):

https://www.desmos.com/calculator/6nl9xleqjo

6 Likes

There is a new beta available:

https://github.com/anikom15/scanline-classic/releases/tag/v6.0.0-beta2

You will find two kinds of presets: professional and consumer. I have still focused on SNES only but I also added an N64 preset as a bonus. I hope comparing the two can help to understand the settings better. If the moire from the slot mask bothers you, you can try shadow or aperture instead. I tried to organize the settings as best I could. Any feedback is welcome.

The next update will have RF and the remaining 16-bit consoles.

  • New parameter system
  • Sharpener circuit
  • Improved color correction
  • New tone mapper and gamut compressor
  • New masks
  • 1 wide color gamut preset included
  • Full HDRR pipeline (SDR output only; HDR output TBA)
  • Optimizations
6 Likes

PAL is working

2 Likes

cool, SECAM is next? :smiley:

There are no true SECAM consoles, but I would like to do it as a hypothetical. However the color carrier is FM modulated which is non-trivial compared to how NTSC and PAL color is implemented, so I’m not sure how accurate it will come out.

2 Likes

Attempt at RF … still a work in progress. I don’t know why the color is so dull, hopefully just a factor of 2 I need to add somewhere.

4 Likes

This is getting closer. The noise model is maybe too aggressive. Hard to say because I don’t have any actual reference to compare to. But I included a lot of parameters to tweak it.

3 Likes

In Composite and S-Video/RGB situations if you can easily see the noise and not just “feel” it, it’s probably too high.

2 Likes

The Neo Geo AES over composite. I was expecting it to look worse since Neo Geo is really meant for RGB. The AES is different from the other 16-bit consoles because it doesn’t derive its master clock from the subcarrier (or vice versa). Instead it has a completely separate master clock and subcarrier oscillator.

The result is a nice blend with no flicker, assuming my derivation’s accurate.

7 Likes

The SNES presets are now in the Libretro shader pack. I will be adding other systems over time, hopefully without needing to change any of the shader code at this point. Before I do that, I think I will make a few generic presets that will be stable for any input size, framerate, so they can be used with cores I haven’t made a preset for.

I am considering trimming the number of shaders in the shader pack down because there are a lot of variants for each system. I have already decided to limit consumer presets to one per system per region (usually composite). People could download the full pack themselves.

7 Likes

Be warned that online updater never delete files from user’s storage.

3 Likes

FYI I updated the bezel code which will now account for having a display aspect ratio other than 16:9. It will be in the next update which will be done on a weekly basis, probably Thursday or Friday.

For now RA scaling should be set to 16:9.

1 Like

I updated the OP as the old one was very out of date. I included information for all the parameters. The debug parameters are not official and may change at any time. I wanted to note some things about performance:

The RGB presets (usually the ones in the professional folder that don’t have any suffix, e.g. sfc.slangp) are the fastest performing. In order from fastest to slowest it goes RGB > S-Video > Composite > RF, with each step in performance being approximately exponential.

The bezel glow is a huge performance sink. If you set the Bypass glow setting (at the very bottom of the parameter list) to 0, you can get that performance back. The bezel itself can also be bypassed for further performance benefit as they are large textures.

2 Likes

I did try your snes preset but with PS1 game

seems good but the phosphor decay seems out of control :slight_smile:

I know that I need to play with the settings, but normal users usually dont, they may try the shader/preset and if they find that it has some artifacts they will mark it as “bad”

also, why it has to be a preset for 1080 and another for 2k etc…? is it hard to make the shader work in adaptive way with the screen resolution?

I also dont like the idea of having preset per console, but currently that has reasons, and I hope that the Libretro developers will find a solution in the future

The expectation I have for ‘normal’ users is to use a matching preset or ask me to make one for them which I will happily do as time allows. Getting the timing parameters right is highly technical, and there isn’t really any way to stop things from blowing up if the wrong values are set. If you load up the wrong preset I would actually hope it looks terrible so you know it’s wrong right away (I even considered making the screen magenta, or show warning colors when certain things go outside of the intended range, but for now haven’t done that).

The parameters are listed roughly in order of easiest to understand to most advanced/esoteric. But the reason for having parameters instead of putting the info into the shaders and selecting with some kind of lookup function is to at least allow someone who is familiar with the system but not familiar with shader programming to modify that aspect themselves (i.e. emu devs). The parameters are also very important for the development itself. I need to be able to see changes in real time for debugging.

The presets will work for other display resolutions, I test it on 1920x1200 as well. The current presets are optimized for 4K. There have to be separate presets for SDR, WCG, (HDR in the future) because they fundamentally work differently.

Even if we had all the uniforms, we would still need individual presets for RGB, S-Video, Composite, RF because people have different preferences for the signal format. These shaders are different than something like Blargg’s composite shader where the different options are just different mixes of the same noise model. In Scanline Classic, there are different pipelines for each signal type, and there are currently three different composite techniques because there were, in real life, different ways composite video was encoded.

When the generic presets drop this week, you will be able to compare and see how different the shader result is when the system timing is not set correctly.

4 Likes

well, I dont mind having more parameters, it’s on the contrary, I like to have many options, but I talk about a balanced default settings for the end user

it’s fine, but isn’t there are way for shaders to know if HDR being used? maybe it also need some uniforms variables?

that fine, but I prefer to have auto option in shader to select between S-Video, Composite, RF based on the console (like if the “cable” option set to auto and if it NES it will select RF internally and if it Genesis it will select Composite ETC…), and the same Logic can be used to select between CRT mask types

all of that above will be nice in case of generic preset which should make live easier for general users who are not deeply involved in technology, and also for those who want something that works with minimal intervention on their part

I dont mind having individual presets if there are a generic preset, also I like to have presets that represents specific CRT TV sets or CRT Monitors etc… and that will be nice for preservation too :slight_smile:

1 Like

Testing RGB mode with Intel Iris Xe Graphics on a laptop at 1920x1200, I can get close to full speed with the Vulkan driver (and the laptop isn’t plugged in) and reducing glow diffusion, glow radius. D3D12 performs a bit worse.

In composite mode, a mix of bezel and the composite processing becomes the bottleneck, turning off the bezel can get to 50 fps.

In RF mode, the RF processing becomes the bottleneck.

Will test how going on AC mode improves things.

2 Likes