ScaleNx - Artifact Removal and Algorithm Improvement

wow, it looks incredible! It looks like this is how good it can get or is there room for improvement still? Great job!

[QUOTE=Hyllian;36728]It looks great! The slopes in level 6 are very good!

Maybe there’s some way to blur a bit less than xSoft, to make it a bit more crispy. IMO, I think that xSoft damage the colors too much.[/QUOTE]

I think i can help a bit. I added a de-blur code section to the 4xSoft which makes it more crispy, in fact, it’s very customizable.

I’ll explain how to tweak it.

This code line manages it all: float filterparam = clamp(2.25*dif, 1.0, 2.0);

If you use for example: float filterparam = clamp(2.25*dif, 1.0, 1.0); then there will be no change compared with 4xSoft.

If you use float filterparam = clamp(2.25*dif, 2.0, 2.0); instead, then every “situation” will get deblured with factor 2.0.

Another interesting setup could be: float filterparam = clamp(2.75*dif, 0.25, 2.0); where similar pixels will get additional blur while there will be sharp contrast on the whole.

The algorithm evaluates the situation (surrounding pixels) and calculates how much deblur it applies, but it must be clamped, because filter values below 1.0 blur the image additionally. (can be helpful sometimes). If we clamp the value between 1.0 and 2.0 then similar looking pixels will stay original while “sharp” situations will get deblured depending from the situation.

It’s a subject of testing and personal preferences…

I hope this shader will be helpful for the excellent ScaleFX or any other filter (high regards to the author) and a satisfying setup will be found / used.

Best regards, guest.r

1 Like

Hey guest.r, welcome! Thanks for all the fantastic shaders you’ve given the community over all these years :slight_smile:

Hey hunterk! Nice to meet you. It’s a privilege.

I’m in awe and amazement over what’s going on here with emulation and shaders. And i’m glad some of my shaders are still considered useful lol.

My personal gol was to code a PS 2.0 2x or 4x scaler with no color comparisons, no logic used or very crude logic. But this postprocessing thingie is really addictive.

Some real effort was put into it by various contributors and it got past industrial/corporate level which i find outstanding.

Everybody keep up the good work!

Regards, guest.r

I have done some work regarding a scalefx presets and found a nice combination. The idea is to apply a smoothing-sharpening filter just before xsoft and there are some good results.

I’m adding the sharpsmoother shader and the preset if anyone wants to give it a try. (sharpsmoother.cg goes into the blurs folder, the preset into the scalefx).

A comparison:

http://screenshotcomparison.com/comparison/176720

Oh yeah, that’s nice! It really smooths out a lot of the upscaling-signature squiggles.

I added it to the common-shaders repo :slight_smile:

back again. I’m planning to revisit the filter and port it to the new vulcan shader specification and I’ve got a more promising idea of how to combine it with reverseAA. though this is still more like an extra, in the first place scalefx is an interpolation filter for pixelart.

just wanna mention one thing, because I saw it misinterpreted here and there. there is no scalefx9. scalefx itself is a filter which triples the resolution and nothing more. the preset (cgp-file) I called scalefx9 is just scalefx used twice to achieve a resolution which is nine-fold (3 times 3). the notation is derived from the scaleNx filters (also known as advmameNx) where the N stands for the factor in which the resolution is increased. the number does NOT stand for the interpolation level which in the case of scalefx is simply 6, there are no variations of it. I hope this makes it clearer.

Ah, yes, thanks for clearing that up, and I look forward to your slang port. I’ve tried porting both it and xbr-lv4-multipass and failed when it comes time to untangle all of the bool4 comparisons.

[QUOTE=Sp00kyFox;52472]back again. I’m planning to revisit the filter and port it to the new vulcan shader specification and I’ve got a more promising idea of how to combine it with reverseAA. though this is still more like an extra, in the first place scalefx is an interpolation filter for pixelart.

just wanna mention one thing, because I saw it misinterpreted here and there. there is no scalefx9. scalefx itself is a filter which triples the resolution and nothing more. the preset (cgp-file) I called scalefx9 is just scalefx used twice to achieve a resolution which is nine-fold (3 times 3). the notation is derived from the scaleNx filters (also known as advmameNx) where the N stands for the factor in which the resolution is increased. the number does NOT stand for the interpolation level which in the case of scalefx is simply 6, there are no variations of it. I hope this makes it clearer.[/QUOTE]

I would love it if there was a way to read a description like this on each shader while in retroarch. Often I have no idea what is happening, just whether or not I like it.

Knowing these details gives me ideas for what to mix it with to make my own presets.

Yaaay, spookyfox! Hope you can get that Reshade version in too some time or another. Or even a PCSX2 and EPSXE version. Really appreciative of these shaders.

Edit: just saw inbox. Had forgotten that I asked you this very thing in inbox. Just ignore then since you already gave an answer there :slight_smile:

improved AA-detection in the non-hybrid version: http://screenshotcomparison.com/comparison/195228

Ah! Nice! That preserves a lot more detail. Good stuff!

Looks awesome.

Edit: Just a remark, but I don’t know if this is possible to fix. xBR as well as ScaleFX have one issue with regard to Super Mario Bros and the SNES All stars version. The eye of mario is always conncted with his beard. Here an example: https://www.youtube.com/watch?v=aHfuliOYd0o

not really. it’s an issue of the small resolution and low colorpalette. scaling filters don’t know what the meaning of a specific pixel pattern is. from the perspective of the shader it looks like pixels that must be connected due to the identical color.

I can’t tell which one is the improved image. I see ‘spikes’ in one of them and I see the 2nd image clears them up BUT they appear in other places. (Small improvements in the background harrison ford, the mini one, and in the upper indiana jones title, but regressions in the small text below)

it’s still WIP.

This is not a trivial task i think, it’s rather a major improvement. My thoughts about the scalefx were more about making it safer to use a high color tresholds because it really makes the fonts looks perfect. Just a thought.

In the meanwhile i made the “soft” version a bit better within the basic preset. This situation is very rare (level2 hi-res slopes) and one of the occasions where a level2 aa method shows up better. For the intermezzo…and a happy new year. :slight_smile:

http://screenshotcomparison.com/comparison/195435

I kinda sensed it a metric change can improve something. First i tried all sorts of metrics in the ScaleFX first pass, but the one it’s currently using is really good. The problem was somewhere else i guessed. I played around a bit with the code in the first pass and made some changes:

// corner strength
float4 str(float4 crn, float4 ort){
    //return (crn > THR) ? max(2*crn - (ort + ort.wxyz), 0) : 0;
    return (crn > THR) ? max(2*crn - (2.0/pow(2.0,SFX_CRN))*pow(pow(ort, float4(1.0/SFX_CRN))+pow(ort.wxyz,float4(1.0/SFX_CRN)),float4(SFX_CRN)), 0) : 0;    
}

The results: http://screenshotcomparison.com/comparison/196342

Perhaps it could be tested some more…

Edit: i’ll include the test file. The 0.70 - 0.80 metric seems to fix some issues.

thanks for the input. I’m already sitting on a new version here though with a revamped strength function. here is the same screen with the current unreleased WIP-version:

http://screenshotcomparison.com/comparison/196372

I was wondering though what shader you used for the level2 AA preset you mentioned earlier.

That looks great overall, but Mario’s eyes go all goofy in the shaded shot.