-
-
Notifications
You must be signed in to change notification settings - Fork 20.9k
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
FXAA exhibits artifacts not present in NVIDIA's reference implementation #64985
Comments
Godot uses a different implementation of FXAA compared to the reference one for simplicity reasons. The official NVIDIA implementation is open source, but it's much more complex as it exposes several quality knobs (which are usually not relevant anymore in 2022). This leads to a slightly different appearance compared to the official implementation. If you have time, look into adapting the official implementation to work with GLSL and always use the Medium quality preset (which is the default). High and Ultra quality presets are not only more demanding, but also more blurry (unlike SMAA's Ultra quality preset which just provides better antialiasing). Note that this issue also occurs in Some comparison screenshots in Tesseract SVN at 2560×1440 between FXAA/SMAA levels (with and without temporal AA). This game follows the reference FXAA implementation more closely: |
The screenshots make it look like the sampling coordinates are slightly off leading to some wrapping artifacts. I note especially how in corners like in the "r" and "W" you can see floating pixels. |
#37819 screen shot from implementation also has this issue it seems.. at the top, there's a floating red pixel next to the red box |
I've been doing more testing, and 3.5 also suffers from this issue. |
I've made a project where I've made a Post Processing FXAA Step, and ported the Godot FXAA to the GDShaders to play around with, and I think I've found what the issue is with Godot's FXAA Implementation. The Direction Vector is messed up, which would explain why there seem to be sampling issues
From testing it doesn't seem like it matters if the direction is pointing from brighter to darker or the other way around, so here's the corrected directions There are still some issues with FXAA when compared to Nvidia's reference, however they seem to be there due to missing steps in Godot's FXAA implementation |
@mrjustaguy Great work! Will you be making a PR? |
I don't really use Git so it'd probably be a better idea for someone else to make a PR. |
I wasn't able to get improved visuals with the code changes above. So I looked into the original source to see if there is an explanation (there isnt) but I noticed we sample the wrong pixel positions. (Zoom in to see differences) Test scene with FXAA in master: Test scene with fix proposed here: Test scene without fix from here, but with improved sample positions: |
Yeah my bad, the ghosting introduced looked like AA in the case I was testing on and the solution seemed to make sense on the surface.. |
Godot version
4.0 Alpha 14
System information
Windows 11, Vulkan, Nvidia GTX 1050 Ti, 512.15
Issue description
Godot's FXAA implementation creates unusual wave-like patterns on the image.
Comparison (Native res rendering (1.0 render scale), taken in the current dx12 branch for Nvidia Driver FXAA to work):
No FXAA
Godot FXAA
Nvidia Driver FXAA
Steps to reproduce
Add some geometry to look at and enable FXAA.
Lowering the Resolution Scale makes the artifacts easier to see, but they also happen on smaller (screen space) more complex objects at full res
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: