-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update FXAA to be simplier and support transparent backgrounds. #23768
Conversation
3e9d580
to
f506dc6
Compare
Thanks! |
…ob#23768) * update FXAA to be simplier and support transparent backgrounds. * add in Daniel Sturk FXAA improvements * add Daniel Sturk credits.
@bhouston I must say this change significantly reduced the quality of FXAA. The new version is much blurrier. And edge detection much worse. (increased contrast for visibility) I had to revert to the old version. While edge detection can still be tweaked in this new version, I find the overall quality much inferior. I know the original shader is huge and could be slimmed down, but surely we'd want to retain the original quality? |
Namely, I can't find these constant tables anywhere in the new version. #define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 4.0
#define FXAA_QUALITY_P4 12.0 Maybe if we just brought these values back it would fix the blurring issue? Edit: Nah didn't help. There's some other issues with the new version. |
@DanielSturk Pinging you as you're allegedly a co-author.
|
@swift502
|
@DanielSturk Thanks a lot for the response. I guess my other concern is if it's still fair to call your algorithm FXAA?
#define FXAA_QUALITY_P0 1.0
#define FXAA_QUALITY_P1 1.5
#define FXAA_QUALITY_P2 2.0
#define FXAA_QUALITY_P3 4.0
#define FXAA_QUALITY_P4 12.0 If your algorithm has significant changes from "traditional" FXAA implementations, wouldn't it be more fitting to offer it as another AA method, alongside FXAA and it's flaws? |
I have no opinion on the naming. To clarify, this wasn't an in-depth research project but rather a 2-3 day effort to fix the limitations with the shader that were blocking our company at the time. Afterwards, BenHouston contributed these changes back to mainline in this PR |
IF there is indeed a regression in quality which this approach, I suggest we either undo it, or rename this version and add a new one. It is a major issue that FXAA doesn't handle transparent backgrounds as currently implemented. It would be amazing if we could keep the traditional FXAA quality with support for transparency. |
That's my goal, to match the appearance of the Nvidia reference implementation. I just double checked that transparent backgrounds work with my proposed shader, and it seems to. #29524 (comment) If y'all have some use cases to test out, I'd be happy to make sure it's gonna be a worthy upgrade. |
Description
This replaces the FXAA code to just the code that is required, rather than hundreds of lines cut and pasted from an NVIDIA example. It also contains an improvement to enable FXAA to work properly with transparent backgrounds (which was noticed here in 2018: #12046 (comment)) and a slight improvement to edge handling. Credit for the improvements go to @DanielSturk.
In order to show that FXAA now works on a transparent background, I modified the main FXAA demo to use a transparent background. Prior to this it was solid white.
This contribution is funded by Threekit.
Before change when rendering on a transparent background (look at the right):
After change when rendering on a transparent background (look at the right):