Deband
- empleat
Please Log in or Create an account to join the conversation.
- Duran.te
About the values for the very high preset, based on my tests, I think we could work with these ones as starting point: Average and Middle threshold something around 6 and the Maximum threshold around 10.
Here there's the difference between "high" (left) and my custom preset (right), which takes away some details in normal games, but should offer better debanding on gradient based ones.
Please Log in or Create an account to join the conversation.
- empleat
BUMP
Please Log in or Create an account to join the conversation.
- spiro
Most users probably use this for debanding skies but don't want to lose detail in the foreground. A depth mask, based on Reshade's depth buffer, would be a good way to solve the problem.
I am currently playing Risen 2. The sky has a lot of banding. However, if I crank this shader's settings high enough to eliminate all banding from the sky, I lose some foreground detail (cobblestone ground at nighttime is a series of dark blue horizontal streaks, and on high settings the Deband shader smooths it all out).
I tried googling for a Reshade depth mask. I found this post, where someone had succeeded in editing the default UIMask into a depth mask:
reshade.me/forum/shader-discussion/4185-...modify-ui-mask#27402
I have zero knowledge of shader programming, but I tried to do the same. I didn't just copy the shader code from the depth mask linked above - in case the UIMask had changed between versions, I took the current UIMask as my source, did a text comparison with the modified UIMask linked above, and edited in the lines related to the depth buffer. Then I saved the new file as DepthMask.fx and renamed the techniques at the bottom of the file to DepthMask_Top and DepthMask_Bottom.
Although I had no idea what I was doing, to my surprise and delight, this solution worked perfectly ingame. Putting Deband between DepthMask_Top and DepthMask_Bottom gave me a scene where the Deband only debanded the sky and not the foreground. I could crank up the debanding in the sky as high as I wanted with no effect on the foreground.
In practice, I found that raising the number of iterations debanded the sky very efficiently, but they also had an fps cost. So I stuck to one iteration, but as I was now free to crank up the settings, I used custom settings similar to what Duran.te suggests as a "very high" preset a couple of posts above.
So, the solution with the custom depth mask works. However, I could still suggest / request a modification to the Deband shader itself to include a depth mask option. It would probably be more fps-friendly to use one shader for this rather than three (DepthMask_Top, Deband, DepthMask_Bottom).
Please Log in or Create an account to join the conversation.
- spiro
I abandoned the depth mask idea from my previous post, because it was an unnecessarily complicated solution that added processing overhead and thus strained the fps. Instead I decided to add a simple depth cutoff into the Deband shader code. Not only does this solve the problem of loss of detail in the foreground, it probably also makes the shader more lightweight on fps, because it doesn't need to compute anything for foreground pixels.
I experimented with a depth cutoff slider in the UI and discovered that at least in this game, Risen 2, the depth of the skybox is where "float depth = ReShade::GetLinearizedDepth(texcoord)" equals exactly 1. Anything less than 1 is the world in front of the skybox.
Here's the code for my modification of this shader, in case anyone cares. It has a "Sky only" option checkbox added in the UI, on by default. If you want to use it to deband only the sky in some game where the depth of the skybox is at something other than 1.0, you can try changing the value on the line "if (depth < 1.0) {".
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
I am happy to announce the version 3.0 of Deband shader. In this version I have completely changed the banding analysis algorithm, replacing it with Weber ratio and modified standard deviation analyses which according to my testing give more accurate results compared to old versions. I have also added and modified some other stuff as well which you can read in the changelog. As usual I am going to post the release candidate here and if there are no bugs or more improvement suggestions I will push it to the upstream. Enjoy!
Please Log in or Create an account to join the conversation.
- s0ulty
C:\Reshade\Shaders\deband.fx(226,16-41): error X3535: Bitwise operations not supported on target ps_3_0.
4.9 Black Mesa.
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Please Log in or Create an account to join the conversation.
- s0ulty
Please Log in or Create an account to join the conversation.
- Forgiven12
It used to be a matter of leaving Debanding strength on 'high', Iterations maxed at 4, and the gradually decreasing Initial radius from 32 until you get a nice gradient. A little bit of grain in darker areas such as shadows is pleasing to the eye I'd say. Thanks for your work.
streamable.com/qf6gps
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Interesting. Can you please post some non-processed screenshots for testing where shimmering occurs?Forgiven12 wrote: Hi. I updated the Deband shader in my pcsx2 emulator folder from 2.0->3.0. After testing and comparing the two in a 2D sprite heavy game, I'm sticking with the older one. The new version introduces too much unwanted shimmering on anything above 1 iterations, and requires fine adjusting from game to game. I just can't get good results anymore.
It used to be a matter of leaving Debanding strength on 'high', Iterations maxed at 4, and the gradually decreasing Initial radius from 32 until you get a nice gradient. A little bit of grain in darker areas such as shadows is pleasing to the eye I'd say. Thanks for your work.
streamable.com/qf6gps
Please Log in or Create an account to join the conversation.
- Forgiven12
streamable.com/wna9je
PS. Will update once Depth Detection becomes handy but 2D retro games will suffice for now.
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Please Log in or Create an account to join the conversation.
- anontsuki

Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Please Log in or Create an account to join the conversation.
- anontsuki
It works fine, but the weber ratio seems weird. At 0.01 everything is fine, because 0.0 breaks everything, but increasing the ratio doesn't seem to affect anything on the banding map. Not sure what it's exactly affecting. The Standard deviation is really obvious in comparison.
I think it'd be worthwhile to have the tip that the colour green in the banding map symbolizes debanding is working. Do you know what the other colours symbolize though? I saw yellow, in clouds.
It's great though, FFXIV has very subtle banding most of the time and this cleared it up really well. I was able to leave the clouds and other whispy elements unaffected by the smoothing. Depth access also is a really nice little touch.
0.5ms or so with the settings I'm using, basically imperceptible performance penalty.
Please Log in or Create an account to join the conversation.