(H)ybrid high-(Q)uality (A)nti-(A)liasing (HQAA)
- lordbean
- Topic Author
Edit: to those wondering why HQAA has as many optional features as it does, this is basically an empirical summary of the reason. I'm not particularly skilled or experienced yet with ReShade FX and often it's the small optional additions that end up exposing a problem with something else I had done. I'm learning as I go
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.
- Martigen
Just wanted to say I really appreciate what you've made here, it's very impressive! I love how it performs and how clearly you've laid out the toggle-able options, which is a must for me (for e.g. I always use Custom with corner-rounding to 0, I try to minimise impact on text as much as possible, same goes for reducing 'crawling').
I can also sense HQAA is near completion and if you've enjoyed making it you may be looking for something else to cut your teeth on, and to that end I have two ideas for you!
1) Integrate pre-sharpen
In my testing over the years I've found I almost always get better AA results if running AA after a sharpen shader. I highlighted this a while back in a post about shader-ordering. While in theory a sharpen filter should run after to bring out anti-aliased edges, it's been borne out in testing that invariably running a sharpen shader first helps AA methods find and/or complete edges. Of course, with shaders like FXAA which tends to soften the whole image, it's also helpful to run a sharpen filter after as well which is what I often do. But back on topic:
While we can simply run a sharpen shader before HQAA, I wonder if there's some performant or quality advantage in integrating a sharpen pre-pass into HQAA -- i.e. passing on the shader mask to operate on directly instead of applying to the image first (I could be talking out of my butt here with how this works!).
2) Attempt a detail reconstruction
This is probably more out of my butt, but here goes: I noticed in some screenshots you posted a long time ago, and in my own playing with HQAA (and AA shaders in general) in games that distance detail can be lost -- e.g. think chain-link fences with criss-crossing lines at a distance, or ropes, or power lines etc anywhere where the resulting AA ends up removing data and they become incomplete lines, or dotted lines with inconsistent gaps etc. It's just a function of the process.
If my understanding is correct from the method of unsharp masking, this works by creating a mask, inversing it and applying it to bring out edges. If this were combined with a shader like embossing to create thicker edges, then potentially I imagine those said distance thin lines that erased by AA shaders could potentially provide more data to be restored to solid lines, thus preserving that detail. But wait! That would be terrible for the whole image, imagine a semi-embossed-strengthened edge all over everything! Indeed, which is why you'd use the depth buffer to apply it only at a distance, and temper/fade it out gradually as you get closer to the player. Realistically it'd only be functioning gradually somewhere from the mid-point to the the furthest distance from the player I imagine, slowly phasing in. I'm not sure if this is something you'd run after HQAA's main work is done to restore data, or before to help it smooth our re-generated lines, but working that out is all probably part of the fun!
Alternatively to an embossing technique to bring out the lines, perhaps using something like the unshark mask duplicated and offset a pixel in a direction (or two), creating a mask with thicker lines. Again, assuming my butt isn't sprouting gibberish here.
Of course, this type of thing is one reason DLSS exists, to restore detail while AAing, but maybe we can fudge it a little with something like the above methods
Â
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
You might be surprised to learn that detail reconstruction is exactly what the Hysteresis pass does! Although it doesn't directly use a mask or the original scene, a key difference you can observe between HQAA and SMAA when you look at the statistics tab in ReShade is that the edges texture for HQAA is a full RGBA8 texture (SMAA uses an RG8 texture). HQAA piggybacks information about the saturation and luminance of the scene into the blue and alpha channels of the edges texture during the SMAA edge detection process, and then the Hysteresis pass (which runs after both anti-aliasing methods have completed) takes new measures for the saturation and luminance of the same scene, and then nudges the pixel toward its original appearance by adjusting the new saturation and luminance closer to the original values (the exact strength and tolerance of which is adjustable in the configuration).
Regarding using pre-sharpening, I would tend to agree with you that I typically notice better anti-aliasing results when using a sharpening pass first. The reason why I did not implement one in HQAA was (at the time I considered it, which was a long time ago in the scope of the project) because I did not want to do something to the scene that the end user might not necessarily want. However, since I've gained more programming experience, I believe this idea is very likely possible to implement - I should be able to configure a sharpening pre-pass to render to a texture, and then perform edge detection on the texture rather than the backbuffer. I'll experiment with it and see what I come up with.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
Edit: now updated to 18.10.1, which is a largely debug-focused cleanup and polishing update, as well as some more minor performance optimizations and some upkeep towards longer-term code maintenance. This version includes a mode that shows you a pretty functional visual representation of what the Hysteresis pass is doing so that you can configure it more easily.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
While implementing a small helper function for edge detection, discovered and fixed a major problem that was causing SMAA to RADICALLY underperform. Although the new code in 19.0 amounts to relatively little, the boost in quality from the corrected SMAA is so significant that it warrants a full version rollup.
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
Found & fixed a major bug that almost flew under the radar (dynamic thresholding was not working properly for either SMAA or FXAA) - image quality is substantially improved in 19.2 (in addition to the major improvement in 19.1)
Rebalanced all default values and settings based on extensive testing of the shader
Final touch-ups to the setup experience
To my knowledge this version contains no functionality-affecting bugs with any part of the effects both primary and optional, and should be reasonably well-optimized
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.
- NoPippinNo
Sorry to bring it up again, but would you consider at some point looking into a depth-edge assist mode? Essentially restricting the effect to pixels in a radius around mesh edges.
I believe it would prevent the effect from smudging surfaces and distant views like night skies (TAA can really murder stuff like stars) and possibly save on performance depending on implementation.
A similar depth filter on debug view to illustrate (although the effect in question does the opposite and skips mesh edges):
imgsli.com/OTc1MDQ
A shader combining FX/SMAA+CAS for overall picture and a mesh-edge focused TAA would be my Holy Grail of AAs.
Please Log in or Create an account to join the conversation.
- lordbean
- Topic Author
As an interesting observation regarding what I did in 20.0, I noticed an interesting positive side effect. When TAA isn't sure about something and causes it to shimmer, HQAA detects it as "motion" and runs anti-aliasing on it. This doesn't remove the TAA shimmer entirely, but it considerably dampens how much the TAA shimmer stands out.
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.
- sanek7814
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.