Deband

More
2 years 1 month ago #101 by empleat
Replied by empleat on topic Deband
I meant i used 2.0 version of this debanding script. I used reshade 4.3, but it is not working for some reason and i did it exactly like from that post. I can't use madvr, i am using already svp pro and it is to demanding.

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #102 by Duran.te
Replied by Duran.te on topic Deband
@JPulowski. Got it, we'll wait for that, so.

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.

Last edit: 2 years 1 month ago by Duran.te.

Please Log in or Create an account to join the conversation.

More
2 years 1 month ago - 2 years 1 month ago #103 by empleat
Replied by empleat on topic Deband
Again how do i install this for mpc please. I used enb injector and from that tutorial they used reshade 1.0 or 1.1 with sweetfx 2.0. Default shaders worked, but code i copied from this site - version 2.0 of deband script, i named it deband.h as other files in sweetfx folder\shaders had also appendix .h and than i added into sweetfx_settings.txt use_deband 1. But it didn't work. I now tried using reshade 4.3 with SweetFX_1_5-23364 and it doesn't work either. But problem is some files in mpc folder after installing reshade 4.3, which are also in sweetfx folder were already there. So i than added only files which weren't there from SweetFX_1_5-23364 folder afterwards, to not overwrite it. But i am unsure how to install this together. Since there is no turorial how to install reshade 4.3 with SweetFX_1_5-23364. I only found that with 1.1 reshade, which was bundle with sweetfx already. I have banding and it is annoying and shaders i found for mpc doesn't work well, this was my last hope. And as i said only putting reshade32.dll and reshade.fx with code didn't work for me. I found only some tutorial for sweetfx 2.0 and reshade 3.0 and i have no sweet.fx file in SweetFX_1_5-23364 folder. Btw what is newer sweetfx 2.0 or SweetFX_1_5-23364, because i read this is latest version - SweetFX_1_5-23364. So what version should i use for this deband shader 2.0 to be working.

BUMP
Last edit: 2 years 1 month ago by empleat.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago - 1 year 1 month ago #104 by spiro
Replied by spiro on topic Deband
How about including a depth mask option in the Deband shader?

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).
Last edit: 1 year 1 month ago by spiro.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago - 1 year 1 month ago #105 by spiro
Replied by spiro on topic Deband
Okay, I managed to solve this myself. Even though I have no knowledge of shader programming and very little knowledge of any other programming and this is the first time I'm trying out Reshade with any game. But I just looked at the code in other shaders and worked out the logic.

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) {".

Warning: Spoiler!
Last edit: 1 year 1 month ago by spiro.
The following user(s) said Thank You: Viper_Joe, TheNeonWhiteOne, Faustus86

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago - 6 months 4 weeks ago #106 by JPulowski
Replied by JPulowski on topic Deband
Hey everyone,

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!

Warning: Spoiler!
Last edit: 6 months 4 weeks ago by JPulowski. Reason: Added 3.1 hotfix.
The following user(s) said Thank You: Martigen, Viper_Joe, canceralp, s0ulty

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #107 by s0ulty
Replied by s0ulty on topic Deband
C:\Reshade\Shaders\deband.fx(191,4-9): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\Reshade\Shaders\deband.fx(226,16-41): error X3535: Bitwise operations not supported on target ps_3_0.

4.9 Black Mesa.
The following user(s) said Thank You: JPulowski

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #108 by JPulowski
Replied by JPulowski on topic Deband
Thanks for reporting it. Although I was unable to test it I have updated the code, can you please check again and tell me if it gives any errors or warnings?

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #109 by s0ulty
Replied by s0ulty on topic Deband
Seems to work fine now. Tested it. Very flexible, great results in quality (eliminating deband while preserving iq), and performance is very adequate. Head and shoulders above other deband shaders i've used. Thank you.

Please Log in or Create an account to join the conversation.

More
6 months 1 week ago #110 by Forgiven12
Replied by Forgiven12 on topic Deband
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
The following user(s) said Thank You: JPulowski

Please Log in or Create an account to join the conversation.

More
6 months 1 week ago #111 by JPulowski
Replied by JPulowski on topic Deband

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
 

Interesting. Can you please post some non-processed screenshots for testing where shimmering occurs?

Please Log in or Create an account to join the conversation.

More
6 months 1 week ago #112 by Forgiven12
Replied by Forgiven12 on topic Deband
Hey. After more testing I was able to sort out the extra noise/shimmering. In other words good gradients is 100% possible of course but I still prefer much simpler approach to quickly finding appropriate setting case by case. Can you explain how the Iterations knob works btw?

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.

More
6 months 1 week ago - 6 months 1 week ago #113 by JPulowski
Replied by JPulowski on topic Deband
There is no need to increase iterations unless there are wide color banding areas in the image and you cannot detect them even after increased thresholds. Most of the time all you need to do is increase or decrease weber ratio and standard deviation thresholds to find a sweetspot where banding is masked without removing too much detail. You can also use only one of them if you wish to do so but these two methods are selected especially because once combined they cancel each other's errors effectively. You can use banding map debug view to see how much they are detecting, once there is a continuous green color in the banding area it should be enough.
Last edit: 6 months 1 week ago by JPulowski.

Please Log in or Create an account to join the conversation.

More
6 months 1 day ago #114 by JPulowski
Replied by JPulowski on topic Deband
3.1 is currently live for everyone. Enjoy and feel free to submit bug reports or improvement suggestions.
The following user(s) said Thank You: Viper_Joe, Marty

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #115 by anontsuki
Replied by anontsuki on topic Deband
Heya, just trying out your latest Deband filter and I'm getting two errors that reshade is telling me, the big one, I think, is "undeclared identifier BUFFER_COLOR_BIT_DEPTH and I'm also being told of an unexpected expression ')', expected expression

=/
The following user(s) said Thank You: JPulowski

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #116 by JPulowski
Replied by JPulowski on topic Deband
Make sure you are using the latest version of ReShade. And remove and redownload the reshade-shaders shader package.

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #117 by anontsuki
Replied by anontsuki on topic Deband
Oh yeah, that made it work. Seems to require something newer than 4.31.

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.