Add material debanding for use in Mobile rendering method.#109084
Conversation
|
See my comment on the original PR #87350 (review) I don't think making this a material/shader setting is a good idea. The cases where you need this, you need it on every object and having to manually enable it on every material will be painful. |
This PR is built on top of the latest version of #87350 which, as I understand it, only has a global setting This was all done before I first looked at this PR and I've mostly focused on improving the shader code, so maybe I'm misunderstanding something, but I believe Calinou fully addressed this concern already in the original PR? |
Indeed, I already switched it to a project setting a while ago. |
61b4049 to
8014b6f
Compare
use_debanding render mode and property to spatial shaders [allenwp update]8014b6f to
8e063f0
Compare
Calinou
left a comment
There was a problem hiding this comment.
Tested locally, it works as expected (both with HDR 2D disabled and enabled). Code looks good to me.
8e063f0 to
cc881f4
Compare
|
I'm converting this to draft to make sure it doesn't get merged just yet because I've discovered a warning that is thrown when the game launches: It is triggered by this line in |
The GLOBAL_DEF must happen afterwards. I can see for debanding the DEF is in You will likely need to just move it to the RenderingServer to ensure it is defined before |
cc881f4 to
365e8c0
Compare
Thanks for figuring this out for me, @clayjohn! I've pushed the fix. I believe there are no more outstanding issues with this PR. |
365e8c0 to
b150467
Compare
b150467 to
7ca3276
Compare
Note that you can share authorship to a git commit using |
Thanks! This one I actually knew about 😅 -- I think I've done it correctly on this commit; please let me know if I botched it somehow! |
7ca3276 to
8a5ac45
Compare
e5cd339 to
c8a5817
Compare
clayjohn
left a comment
There was a problem hiding this comment.
Implementation is good. Just need to rebase since rendering_server.cpp/h were moved recently
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
c8a5817 to
bd9d1bf
Compare
Rebased, thanks! |
clayjohn
left a comment
There was a problem hiding this comment.
Looks great! Let's merge this now and then I will rebase on top of it with my HDR 3D buffer PR
|
Thanks! |


This PR is a trimmed down and slightly modified version of @Calinou's #87350 -- Calinou should take most of the credit for this!
This PR adds a new
RenderingServer.material_use_debandingproperty that is configured at project startup by the existingrendering/anti_aliasing/quality/use_debandingproject setting. ThisRenderingServerproperty can also be toggled at runtime. This new debanding mode only functions with the Mobile rendering method, but can be extended to the Compatibility rendering method in the future.Screenshots (view at 100% size for correct appearance)
Comparison to original PR
Compared to Calinou's original PR, I have changed the following:
use_debandingso that it affects both viewport and material debandingDither offset
Here is the tool that I used to determine a good offset for the material debanding:

dither-offset-test.zip
In this image the top and bottom bars are the original colour, the left is the base dither pattern, the right is the offset dither pattern, and the middle is the left and right added to each other (in linear space):
For reviewers
Test projects