Skip to content
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

Add material-based debanding as an alternative (or replacement) to screen-space debanding #4193

Open
Calinou opened this issue Mar 9, 2022 · 0 comments · May be fixed by godotengine/godot#87350

Comments

@Calinou
Copy link
Member

Calinou commented Mar 9, 2022

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Godot currently offers screen-space debanding in the GLES3 (3.x) and Vulkan Clustered (master) backends. Debanding currently doesn't work in GLES2 because a LDR rendering pipeline is used there. Vulkan Mobile backend uses an HDR rendering pipeline but with lower precision than Vulkan Clustered (with debanding also not working there).

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a debanding filter that works at a material level instead of doing so at a screen-space level.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Performance seems to be roughly the same from my testing, although it may be slower in complex scenes when the depth prepass is disabled (as is the case in GLES2 and Vulkan Mobile). Transparent materials may also cause debanding to be slower, although we could disable debanding on transparent materials if this turns out to be a significant problem.

On the bright side, material-level debanding will not operate on the sky, saving GPU resources in outdoor scenes. (Instead, the sky shader itself should have debanding, like PhysicalSkyMaterial already does.)

Depending on how well this material-level filter behave, we may consider removing the screen-space approach for 4.0. If there are still valid reasons to keep it, then material-level debanding should be provided as an additional option (ideally in all rendering backends for consistency, even GLES3 and Vulkan Clustered).

I have WIP implementations for the Vulkan Mobile backend and GLES2:

GLES2

Click to view at full size.

Without debanding With debanding
2022-03-09_17 55 47 2022-03-09_18 01 50

Vulkan Mobile

Without debanding With debanding
exposure_1_without_debanding exposure_1_with_debanding

If this enhancement will not be used often, can it be worked around with a few lines of script?

This can be worked around with a custom shader already: https://github.com/fractilegames/godot-gles2-debanding-material

Is there a reason why this should be core and not an add-on in the asset library?

Since games with a lowpoly/stylized aesthetic are often developed with Godot (and I don't see that changing soon), I think it makes sense to provide this as a built-in option. In any case, debanding would still be disabled by default to avoid making screenshots larger when it's not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants