Shader scaling - pixel detection

As u might know some cores have the ability to scale the picture via nearest neighbour. P-uae with higher resolution, snes with mode 7 upscale, desmume with hybrid scaling, beetle psx with higher resolution, etc. Those cores are doubling the pixles so that the shaders do not work properly anymore. Which is a pity because the user can only select one option. It would be nevertheless cool to have both option at once.

My idea for libretro would be to have some kind of pixel detection. Means if it is set to 1 it only considers 1 pixel for the shader input. If it is set to 2, the shader considers a field of 2x2 pixels as 1 input pixel for the shader. This would be useful when emulators scale the image by the factor 2. Therefore the algorithm of each shader can stay intact while the resolution can be increased via nearest neighbour.

What do u think?

1 Like

Hi @papermanzero,

Not sure about retroarch doing it this way, but if you want something which does this you can try out the Mega Bezel shader, it does this kind of scale/sampling thing, so you can have your core outputting 2x the pixels and have the shader sample it as if it was only 1x.

The Mega Bezel does a lot of things like add a generated bezel and reflection, but there are a couple of presets which are bare bones and only have the scaling and curvature, and of course run faster :wink:

  • hsm-screen-scale-crt-guest-dr-venom.slangp
  • hsm-screen-scale-crt-royale.slangp

Here’s an example with Vagrant story where the vertical res sampling is reduced

Before

After

The parameters which adjust the sampling ratio are here: image To get something which where the core was at 2x to look like 1x you would change the Core Res Sampling Mult X & Y to 0.5

1 Like