ScaleNx - Artifact Removal and Algorithm Improvement

Tried an assumption that FXAA could do well with ScaleFX and it turned out quite nice. I’ve assembled a couple of presets, methinks they are the best of the “AA” derrivates so far.

Download link: https://mega.nz/#!ctpCTCrZ!QVtvY6xubjTvIcyWZdnHLAJzX78_vovGbNCIQ9kWMH4

Edit: i removed some useless code, sholud be a bit faster now.

3 Likes

I’ve used it with fxaa and advanced-aa quite a bit, but those presets look a lot better than anything I’ve messed with. They’re quite demanding, lol, but the results speak for themselves 0_0

1 Like

Do u have some comparison screenshots?

1 Like

Sure. I you want a crisper image then Deblur Offset can be increased and Smart Deblur value lowered a bit. The opposite or lowering the Deblur value produces a softer result. :relaxed:

2 Likes

Yep, shaders at 6x resolution can slowdown the composition. I spent some time experimenting with faster shaders and redundancies and managed to speed up the presets quite a bit. Hard to tell now which versions look better, i’ll include the original presets since they have a bit of the “super” look in it. :grin:

I would also like to mention that especially the hybrid version with the essential FXAA is a bit bulky, so the relative speed gain is a notch smaller.

New download link: https://mega.nz/#!8x4l1SAI!VaG3bAa2wfZkoLNN4CMHMbaeev1cv5GZ1GdLn-GDcBM

Edit: You can get even better quality by setting the last pass scaling to 2.0, some sort of supersampling effect. :wink:

By reducing the FXAA search steps to a smaller number, appropriate for ScaleFX, the speed of all presets increased up to 20%.

1 Like

add mdapt Mdapt & gdapt - dithering treatment [Updated 06/06/14]

Hey guys! Holy crap, I just discovered this filter and the latest scalefx-aa presets that @guest.r posted in August. This is nothing short of spectacular!!

@hunterk, will these make it to the repos?

I used to be excited about xBRZ und xBR-mlv4-multipass (still am), but your collective work here blows them out of the water. I’d seen “scalefx” before and thought, hey somebody should anti-alias that, not realizing you guys were already on it :slight_smile:

I just spent 2 days reading through this thread and even though a lot of it is Klingon to me, I have some observations and I hope perhaps I can be of some value with them.

a) aa or rAA?

First, imho the scalefx-aa filter is superior to the scalefxx+rAA+aa one. It seems sharper to me:

I wasn’t quite sure if you guys originally considered / now consider the rAA version superior? If so, why? I didn’t quite glean that from the technicalities along this thread.

b) Faded colours

I noticed that in some cases, colours on scalefx-aa look less saturated than on “nearest” (i.e., original) or 6xBRZ. Check out the bright cyan pixels on the waterfall in Blackthorne or the top left square on the top left flag in Colonization:

I’m wondering if there’s a way to restore the lost saturation or luminance? I retouch photos a lot and I find that in Gimp or Darktable, the “local contrast” (aka “Unsharp Mask”) tools are able to do that. They’re intended to perceptually increase sharpness by increasing contrast between adjacent areas. I’m not sure… Just a thought?

c) Struggles with DOSBox’s “vgaonly” mode

Since the filters only work on unscaled images, they struggle with games like Commander Keen or Prehistorik 2, which require the “vga” mode in DOSBox to work (otherwise they crash).

That mode scales 320x200 up to 640x400 (which is by design), so then you end up with this when using the scalefx-aa filter:

With @hunterk’s help, I was able to work around this using the xbr-mlv4-multipass filter by adding an extra pass at the beginning that downscales the resolution to half before any of the other filter passes run. More info here:

When I do the same with scalefx-aa-fast (here’s the exact preset I concocted), this happens:

I’m wondering if you guys can think of a fix/workaround? I’ll be happy to implement it myself and then provide my preset here, assuming it’s not beyond my understanding.

d) Curves where there should be angles?

I’m pretty sure that’s a “no”, but I noticed that sometimes, the image suffers a bit when the scalefx-aa filter creates curves where there should be angles. For example, the t in “Nintendo”:

There’s probably no way to make these filters smart enough to work around this?

Anyway, so much from me for now. :slight_smile:

1 Like

Just a very quick update re. my point c), struggles with DOSBox:

I kinda “worked around” this by re-installing and configuring RA completely new, from scratch. Since then, all my DOS games have been running out of the (DOS)box (heh), without much need for additional config.

So I guess something was borked in my old RA install that caused the issues I had.

I’m wondering whether you guys are planning to make this set of ScaleFX+AA filters available in RA’s shaders repository in the future? I really think they’re spectacular.

1 Like

They should be there already, they’re just in the ‘presets’ directory:

2 Likes

Ahhhh, yes, thanks! I wasn’t expecting them there. :slight_smile:

1 Like

Hey guys, I sharpened the scalefx-aa-fast preset just a tiny little bit. I like how it came out, it feels crisper on my 32" 1440p screen.

Original scalefx-aa-fast:

default

Sharpened, you can see it well on the tent or Sophia’s hair:

sharpened

Here’s a side-by-side comparison:

To achieve this, I set the following in “Shader Parameters”:

  • Deblur offset: 2.25
  • Deblur str.: 5.50
  • Smart deblur: 0.05

Here’s a preset that you can download and put into your root “shaders” folder (the parent folder of “shaders_glsl”):

4 Likes

I don’t know if it’s just for me, but ScaleFX isn’t working anymore, this is the log.

[INFO] [slang]: Compiling shader "D:\Retro\shaders\shaders_slang\stock.slang".
[INFO] [slang]: Using render target format R8G8B8A8_UNORM for pass output #0.
[INFO] [slang]: Compiling shader "D:\Retro\shaders\shaders_slang\scalefx\shaders\scalefx-pass0.slang".
[ERROR] ERROR: scalefx-pass0.slang:97: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]
ERROR: scalefx-pass0.slang:97: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]
ERROR:
[ERROR] 
[ERROR] Failed to compile fragment shader stage.
[ERROR] Failed to compile shader: "D:\Retro\shaders\shaders_slang\scalefx\shaders\scalefx-pass0.slang".
[ERROR] [Vulkan]: Failed to create preset: "D:\Retro\shaders\shaders_slang\scalefx\scalefx+rAA.slangp".
[ERROR] [Vulkan]: Failed to create filter chain: "D:\Retro\shaders\shaders_slang\scalefx\scalefx+rAA.slangp". Falling back to stock.
[INFO] [slang]: Building pass #0 (N/A)
[INFO] [Vulkan filter chain]: Not using frame history.
[INFO] [Vulkan filter chain]: Not using framebuffer feedback.

Others shaders are working.

Hmm, still works here. Can you post a full log?

Sure! This is scalefx+rAA+aa.slangp https://pastebin.com/jxNhxhrp

can you try the same preset with glcore or d3d11 video driver?

Done, https://pastebin.com/hVUvP8dN Same thing, I just reinstalled my GPU drivers with DDU, no changes at all.

Edit: Tried with a fresh stable version of Retroarch, it works. The last nightly build won’t work, even with a clean .cfg.

Alright, I think I got it tracked down and fixed in this PR: https://github.com/libretro/RetroArch/pull/10843

Thanks for the report!

EDIT: twinaphex pushed a different commit that fixed just that specific error instead of reverting the whole bit, so if you run into any others, do let me know.

2 Likes

Hi, guest.r First of all, congratulations for you great shaders, I found today this and looks stunning :wink:

The reason to contact you is to ask for permission to use your shaders on the Duckstation emulator, this is a PSX emulator developed by Stenzek and I think your shader will fit perfectly in order to render 2D backgrounds. I opened a PR but first we need your approval to include it. What do you think?

Thanks a lot!

1 Like

It’s OK regarding my included shaders, they are already GPL v2 or later. But you can use them nevertheless if there is a license discrepancy.

1 Like

Fine, thank you so much :smiley: