-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Integrate contrast-adaptive sharpening (CAS) in the Vulkan renderer #1519
Comments
Is there a pr for this? Since you added FXAA, is it possible to run the AMD FidelityFX the same way? |
@fire I haven't started work on this yet, but that's the idea 🙂 |
I have a WIP branch that uses the old pure fragment shader version of CAS: https://github.com/Calinou/godot/tree/add-contrast-adaptive-sharpening It currently breaks any post-process step placed before it (such as FXAA and tonemapping), I don't know why. Also, we should expose the sharpness intensity as a Viewport property. Edit: Fixed (it was a porting mistake of mine in the shader code). Pull request opened: godotengine/godot#47401 |
Contrast Adaptive Sharpening was merged in the The |
This comment was marked as off-topic.
This comment was marked as off-topic.
@TheRealFame Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
Describe the project you are working on:
The Godot editor 🙂
Describe the problem or limitation you are having in your project:
When MSAA is too expensive or not effective enough due to frequent use of alpha-tested surfaces, developers typically fall back on a screen-space antialiasing algorithm like FXAA. However, unlike MSAA, screen-space antialiasing algorithms will make the image blurrier to help decrease aliasing. This can make players avoid using antialiasing altogether, especially at lower resolutions where the lost sharpness is often considered unacceptable.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
A sharpening algorithm can be used to recover some of the sharpness lost when using a screen-space antialiasing algorithm. Contrast-adaptive sharpening (CAS) has been a popular method in recent games.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Integrate a contrast-adaptive sharpening shader such as the MIT-licensed AMD FidelityFX.
In addition, FidelityFX also supports fast upscaling in addition to sharpening, which could be useful to further improve the visual quality with dynamic resolution scaling or when the resolution is lowered for performance reasons.
Implementation recommendations can be found in this slideshow.
Note that since FidelityFX uses compute shaders, this feature can't be backported to the GLES3 and GLES2 renderers.
There's also a pure GLSL fragment shader version that doesn't support upscaling and may be less efficient, but it should be easier to integrate. It can be backported to the GLES3 renderer, but not GLES2 as it relies on
textureLodOffset()
.If this enhancement will not be used often, can it be worked around with a few lines of script?:
On Linux, CAS can already be injected into Godot thanks to vkBasalt. Other programs such as ReShade may also be able to do this on other platforms.
However, injection-based approaches will often apply sharpening to 2D elements, making the editor and GUI elements appear unnecessarily sharp. A proper CAS implementation in Godot will make it possible to sharpen only 3D elements.
Is there a reason why this should be core and not an add-on in the asset library?:
See above.
The text was updated successfully, but these errors were encountered: