-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Implement FXAA 3.11 to replace the current broken implementation #89582
base: master
Are you sure you want to change the base?
Conversation
Can someone confirm the license and origins of this code, see the discussion in: |
I just found the License text in the gist https://gist.github.com/kosua20/0c506b81b3812ac900048059d2383126 which links to the implementation at https://github.com/kosua20/Rendu/blob/master/resources/common/shaders/screens/fxaa.frag that I've used.. Don't know How I've missed it.. |
It says "cleaner version" but does that mean it's just a copy? The original code is proprietary/closed yes?
Nothing about any ability to share it, are they the author (even if they are, that doesn't mean they can share it if it's for a company)? Otherwise this looks very fishy and not valid |
which links to |
The link to the license in that page is dead, as is the link to FXAA 3.11, so that doesn't seem like a confirmation, so all we have right now is explicit stating "it's all rights reserved" In either case this requires a license inclusion, BSD 3-clause requires that For my part I'd prefer a properly sourced reference to copy, with a clear license statement, from some original trusted source |
Well all the official Nvidia links regarding FXAA seem to be dead so... |
So then there's no original reference to it being open source, so that's a big issue Even if we take that statement at face value the source you've copied violates that, it doesn't attach a BSD license to the source, the FXAA 3.11 isn't public domain As said by clayjohn this was already known previously and we've been wanting to implement it but licensing stopped us, so it might be we were wrong before but it doesn't seem that way and that we're still unable to based on the same issues as before |
Even that claim about it being open source licensed is far not up to the standards of Wikipedia, a random blog or forum post isn't a valid reference, and the fact that they don't quote a proper source is a huge red flag to me, if it was possible to find a NVIDIA source for it being licensed like that it would be on the Wiki page, trust to Wikipedians to fix that quick if they can With something like a big company like NVIDIA I wouldn't believe that they've released anything open source without seeing it from them directly |
Well I guess the only way to resolve this is to contact Nvidia, and see if the Wiki information is right or not, and pray they answer. |
In either case this source is not compatible with that unless it's under a public domain license, so in that case you'd have to find NVIDIA source code, this code is copied from a page which claims copyright for the code without any attribution to NVIDIA or any original author I don't think this is safe or realistic as a way to proceed, unless you can find a primary code copy to work with Edit: Given the phrasing in their comment this might be original code, if that is the case then we'd just need to cite them properly (this code currently violates the license of that code, so you need to fix that), assuming it's a valid implementation
However I don't trust that, they say they have a:
Which to me reads as a cleaned up version of that source, not their own creation, which wouldn't be valid Note: The only evidence we have currently for NVIDIA releasing this under any license is:
So it's like very not any evidence lol |
Well, Bevy is using the Gist FXAA implementation - https://github.com/bevyengine/bevy/blob/main/crates/bevy_core_pipeline/src/fxaa/fxaa.wgsl |
Well their header claims that it's a cleaned version of the NVIDIA code, which is very clearly not open source unless there's some part in that code I missed, as see above it says "ALL RIGHTS RESERVED", also this one also doesn't give proper attribution and license details 🙃 so it still all hinges on the original NVIDIA code being open source, and if it is that would just mean we need to find how to add proper attribution The original gist looks like it's a decompilation of the code, given it contains compiled assembly, which to me is a red flag, if this was legitimately released by NVIDIA wouldn't there be actual licensed code by them? Or is the gist just very strangely formatted and laid out? |
That does look more legitimate, and Blender is big enough to get in trouble, but is that actually FXAA 3.11? However unless that's hugely rewritten in the version you have here that looks nothing like this code Also it says "BSD-3 AND GPL" which is confusing, and if it is GPL we can't use it |
The original Gist seems like the same thing as the Blender FXAA, and the code I used is a cleaner implementation of the Gist made by the author of the gist... GPL prob for the blender tweaks stated, IIRC all blender code is GPL |
The cleaned code that I used when porting code to Godot and the source code (both gist and blender versions) seem to be doing the same thing, it's just that the source didn't use things such as iterators which blew the number of lines of code like crazy.. Given Wikipedia states BSD3, and Blender actually confirms BSD3, and the gist is also used by bevy (the same implementation as I've ported) I'm fairly confident if there were Issues, Nvidia would have taken action long ago, especially given the Size of Blender and the fact they clearly know about Blender for quite a long time, and I think for a while they were even Sponsors, though could be wrong on that one, as I don't see them on the Sponsor list for blender.. |
It doesn't cite a remotely reliable source though, so let's not use it as an argument, this sounds like a game of telephone and there's no actual original source of this claim The Wikipedia source is a screenshot, of a person claiming to be the author of the code, claiming it's open source, that's all we have, if we look at it critically That is not a valid source (that's not a screenshot by me, that's literally the source Wikipedia uses), it also doesn't say anything about the 3.11 being BSD The NVIDIAGameWorks gh doesn't even have the samples in question any longer, so the supposed license doesn't exist Regardless of the legality I feel it's irresponsible to add code for which the original cannot be verified and the claims about it being open source are highly questionable |
https://github.com/AmplifyCreations/FXAA This website has a copyright notice for FXAA. |
This comment was marked as outdated.
This comment was marked as outdated.
Yes the second of those links were discussed above and the issues with that all the references there are dead links Also that's FXAA 3.9, not 3.11 The first link doesn't have any licensing and all it states is all rights reserved and no basis for sharing it |
A clear response would be for us to remove FXAA? I could try asking Nvidia what license it is and they can make a redeclaration? And this is a gist... https://gist.github.com/kosua20/0c506b81b3812ac900048059d2383126 which isn't that great. |
I don't know about the existing implementation, where it's from Note that the theory behind FXAA is available (and you can't copyright it), so if the FXAA code is original it's fine, it looks relatively original CC @reduz you added this, where did you get the implementation? |
This comment was marked as outdated.
This comment was marked as outdated.
I will get in touch with NVidia. It seems that the linked source (https://github.com/hghdev/NVIDIAGameWorks-GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h) is a mirror of something that NVidia originally posted NVidia posted the entire graphics samples to github, but then removed them at some point https://developer.nvidia.com/gameworks-vulkan-and-opengl-samples-30-released (link at end of article). I trust that the mirrors we have seen accurately reproduce the licence (so in theory it should be fine if we do as well), but its best for us to double check with NVidia before doing anything. More tidbits:
edit: Turns out the version 3.00 of the gameworks SDK (still up on archive.org) contains the source for FXAA 3.11. Which is the same as the hghdev mirror (https://github.com/hghdev/NVIDIAGameWorks-GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (rebased on top of master
29b3d9e), it works as expected. This noticeably improves smoothness, especially on near-parallel lines. Image sharpness isn't noticeably affected by this PR.
Testing project: test_pr_89582.zip
This uses the approach described in #89582 (comment) for testing.
No AA | FXAA Before | FXAA After (this PR) |
---|---|---|
![]() |
![]() |
![]() |
4× zoom:
No AA | FXAA Before | FXAA After (this PR) |
---|---|---|
![]() |
![]() |
![]() |
Comparisons between the new FXAA and Tesseract's FXAA on Medium and Ultra quality:
FXAA PR | Tesseract FXAA Medium | Tesseract FXAA Ultra |
---|---|---|
![]() |
![]() |
![]() |
4× zoom:
FXAA PR | Tesseract FXAA Medium | Tesseract FXAA Ultra |
---|---|---|
![]() |
![]() |
![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still needs proper attribution, this is not in line with the linked repo's license (i.e. regardless of the source being valid this copy of it isn't)
I'll defer to the legal people on he legality of this, and wash my hands of it, I'm not convinced but I defer to them
Though I'd say to check with Nvidia properly before merging, though I'd still prefer basing our version on one with proper attributation to Nvidia, like the Blender one, as this one isn't compliant with the license seen elsehwere as it doesn't reference the Nvidia license anywhere
To be clear, I won't stand in the way of this being merged with correct attibution, but I'd very much prefer it if we base it on a version that actually follows Nvidia's licensing in the mirrors, i.e. mentions them as originators at all |
Well for the attribution, I just need to know where to place what |
You should copy this license text and add it next to the link you have, assuming we're going with this and not the properly sourced one linked above |
isn't there like a place where we put all of the licenses and their texts? |
Not for included code, those cases are for licenses in 3rd party code, the license has to be with the code |
Any issue with listing the license at the top of this file? Regardless of the fact that this is from a fork of a dead repo, the license attached to the file should still stand:
It stands well enough for Unity to use it (I know, not a great argument, but still, it's something). |
Revisiting this. I see that I mistakenly thought that the 3.00 version of the Gameworks SDK did not include FXAA 3.11. But it did. Accordingly, I can confirm that the mirror hosted by hghdev contains the most up to date version of FXAA from NVIDIA. Accordingly, we should use that version and we should copy the licence text from that version (https://github.com/hghdev/NVIDIAGameWorks-GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h) This PR uses the wrong licence (it uses the licence for Rendu, not FXAA). To move forward with this PR, we need to update it to use the correct licence, and then also reproduce the licence in the Lines 131 to 133 in 292e50e
|
Is there anything else that needs to be done for this to be merged then? |
Probably not. I still need to do a careful review of the code, but if everything is working well then we can merge this for 4.4! |
This comment was marked as off-topic.
This comment was marked as off-topic.
One big issue is that FXAA is run before tone mapping. It should be run after tone mapping to best identify edges and gradients. |
That's outside the scope of this PR IMO, as it's just replacing the algorithm, there are things beyond when it runs that may make sense to change later on. |
Should this be moved to 4.5 now that 4.4 is in beta? |
Resolves godotengine/godot-proposals#9300
Fixes #83089
Improves Temporal stability over the old implementation (No Issue on github opened regarding the extremely low temporal stability of FXAA in motion)
Implements FXAA 3.11 to replace the current Godot FXAA implementation which is heavily messed up.
Multiview Hasn't been tested (nor can I test it) and Need to find the exact license text for FXAA 3.11, and where to place it in Godot, so help with these aspects is very welcome.
No AA:

New Implementation:

Old Implementation:

Note: don't mind the performance metrics, for some reason they fluctuate heavily between 4 and 5ms all the time in the scene regardless of version and AA used/not, and these are just the numbers that happened to be at screenshot time, Actual benchmarks are required to determine actual performance differences.