(H)ybrid high-(Q)uality (A)nti-(A)liasing (HQAA)
- lordbean
- Topic Author
Edit: v2.9.2 now up. Turns out a good chunk of the remaining artifacting problem wasn't a balancing issue, it was a logic issue. When I calculated maximum color separation for the pixel being processed I forgot to check contrast between green and blue, resulting in a hole in the results for certain color shades and thus an incorrect amount of sharpening being applied. It is now fixed and produces more consistent output.
Edit 2: v2.9.3 up. Now that I'm sure the inputs I'm using are being calculated correctly I rebuilt and retuned the final FXAA sharpen amount calculation. I don't think it generates artifacts any longer, spurious outputs on text seem to be coming from the anti-aliasing portion of FXAA at this point. The rebuilt calculation also adjusts itself better as the shader settings change since I used less constants than in the previous version.
Edit 3: Current version is up to 2.10.3. Implemented some new trickery with FXAA (it can be run on color pixels only, grayscale pixels only, or as a full pass) and the coarse passes added by DPI now start at 1080p, with passes alternating between color-only and grayscale-only. The sharpening calculation also got a tiny bit smarter again (it now considers how strongly the pixel cleared the edge detection threshold in the calculation).
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Implemented witchcraft. Seriously, I don't know what I did. I was messing with the FXAA sharpening math WAY too late at night, tried something, and somehow ALL the blur disappeared. v3.0 has more aggressive presets, runs two fine FXAA passes by default, adds more of them as the DPI goes up (the coarse pass has been retired since it now seems irrelevant), and it somehow looks clearer than v2.x and even has a higher hit rate on real aliasing.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Edit: there was still a lingering bug in the new sharpening process which I have now fixed and pushed as version 3.2.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Edit: v4.1 is now up, which revamps FXAA's logic used to select the primary luma color and rebalances the SMAA gamma bias applied to its luma weights. See below for a 1080p before/after.
Please Log in or Create an account to join the conversation.
- Tojkar
I do audio engineering by trade and sound designing and producing music as a hobby. Out there it's well known fact that the faster you do, the better the quality is. The reasoning is that the longer you spend time listening what you're doing, the more you bias you hearing to find problems that actually are not there and it could easily spiral down to endless tweaking and fixing without ever being able to make a final product. When the process cannot be done fast, pauses are extremely important to "reset" your hearing and the bias of finding problems.
I have not doubt that the same would apply the shader coding when you look at the screen, tweaking the code and observing the changes. Too long time doing that and you'll surely bias your brains to find all kind of problems and places for tweaking and essentially become blind in search for perfection.
Just a friendly tip, nothing more.
On topic: The last version I've tested is 3.4.1. The one before that was something from the 2.x series. It seems apparent that the slight angles cannot be perfect on fullHD resolution without excessive blurring but it still seems to be much better on the later versions.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
As far as taking breaks, I'm probably starting into one as of v4.1.2. I feel with where the shader is at that I have optimized the output about as far as I can on a 1080p screen; I need to see results from my 1440p monitor before I can continue to make improvements.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Btw Tojkar, I don't recommend using a version lower than 3.4.7 long-term. There's a silent bug in the code in versions .4.7 that will crash the game if you enable performance mode with the custom preset selected. It took me a while to find it since I'd just been testing primarily using the Ultra preset, and Custom works fine in those older versions while in setup mode.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Both of these new features are listed as separate effects in the ReShade list. The denoiser can be moved around freely in the list before/after other stuff (including HQAA), and the same is true of the CAS pass but with a quirk - if you place it above HQAA in the list, the SMAA detection part won't do anything.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
As a further example, here's a scene which is almost entirely a false positive (a menu).
Please Log in or Create an account to join the conversation.
- Tojkar
I noticed that the blue parts in the Klegg tower are almost completely untouched even though they have very obvious aliasing. Why are those considered negatives by the shader?
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
The longer answer is because the first step of SMAA edge detection is to test the red and green color channels of each pixel looking for high-contrast areas, and then rendering to a hidden texture (which can be observed in the statistics tab) a red pixel for a probable vertical edge, or a green pixel for a probable horizontal edge (or if it thinks it's seeing both, it lights up both red and green on the texture, resulting in yellow). In all the experiments I've done with it, attempting to force it to use blue as the luminance color simply results in it missing edges everywhere - the less it relies on blue for luma, the more edges it detects. I tried to work around this as much as I could with my adaptive luma selecting methods in the first step, and it even takes a much stronger read from the gamma of the pixel (normally ignored, that's something else I did) if it detects a pure-blue scene, but overall results are going to be very hit and miss if there's no green or red for it to work with whatsoever.
Edit: that does give me an idea for a possible way forward though. It'll take me some time to experiment with and see if there's any merit to it, but there's some potential that I could have it jump horses mid-pass from luma detection to color detection if the adaptive luma process results in the fallback case of 3/8 blue, 5/8 gamma. It ought to be possible to use that as trigger condition to hook out to color edge detection and then just return the result from that routine.
Further edit: Chicken dinner for you, I believe. It's going to need more testing, but initial observations suggest this process works.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
That goes for anyone else too, happy to explain (to the best of my ability) how or why I did something or why something happens the way it does with my shaders. Outright feedback also welcome, both positive and negative, as long as it's constructive. In the last two weeks the shader has gone from blurry and barely usable on 1080p to sharper than TAA with an anti-aliasing success rate almost on par with TAA at 1080p.
Please absolutely continue to point out where you can see the shader missing edges or generating odd results.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Man, revisions fly when you're having fun.
Please Log in or Create an account to join the conversation.
- klotim
14:04:07:381 [03896] | ERROR | Failed initializing "C:\Program Files (x86)\Origin Games\Dragon Age\bin_ship\reshade-shaders\Shaders\HQAA.fx":internal error: argument pulled into unrelated predicate
Same with for example 6.0.
I removed all the settings from reshade preset regarding hqaa.fx but still no success.
Dragon age origins is a dx9 32bit game.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Please Log in or Create an account to join the conversation.