Deband
- klotim
- JPulowski
- Topic Author
Martigen wrote: Do we know what other effects Dither make an impact on/is worth enabling the performance hit? I know vignette, but that's about it.
Yes, every effect might introduce banding.SunBroDave wrote:
Yes. Use SweetFX's Dither effect to lessen banding from other effects.Wicked Sick wrote: Guys, can other effects introduce banding?
SweetFX's dithering shader only applies dithering to SweetFX's shared shaders.
Which are:
- Nostalgia
- Levels
- Technicolor
- Technicolor 2
- DPX
- Monochrome
- Color Matrix
- Lift Gamma Gain
- Tonemap
- Vibrance
- Curves
- Sepia
- Filmic Pass
- Reinhard Linear
- Vignette
- Film Grain
It doesn't affect any shader except the ones above. Deband shader has an additional independent dithering option to smooth out the results.
In my tests I found that the optimal position for the deband shader is the first place. But you might play with its position to see how the final image gets affected.
Please Log in or Create an account to join the conversation.
- Wicked Sick
Changing the order also affect the FPS?
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Yes, changing the order might also change the final image. For instance, using Paint shader after LumaSharpen will make LumaSharpen uneffective. Think it as using Photoshop.Wicked Sick wrote: So, changing the shaders order will change the final image? I am sure I have read something about this around here, but I feel like dying (flu and stuff) and my brain ins't what it used to be.
Changing the order also affect the FPS?
And no, there shouldn't be any difference in performance when changing shader order.
Please Log in or Create an account to join the conversation.
- Wicked Sick
Please Log in or Create an account to join the conversation.
- Arioch
Thanks!
Please Log in or Create an account to join the conversation.
- Alo81
It fixed my biggest gripe with The Fall, being the constant horrific banding.
You must view them at full size, as resizing can add additional banding.
Vanilla
Deband + Martins Film Grain
GIGANTIC improvement. Thanks so much OP.
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
Since ReShade 1.0.0, SweetFX + ReShade bundle is unsupported. I suggest using ReShade Framework if you aren't already using it. Framework includes all the currently available shaders compatible with ReShade.Arioch wrote: I would love to try this effect. Currently I am using Reshade to add SweetFX 2.0 in Witcher 3. What would I need to add to my existing installed files to add just the deband effect to my existing SweetFX files?
Thanks!
Adding custom shaders to SweetFX + ReShade bundle is possible but it requires some technical knowledge and some tempering. Like I said using Framework is a lot easier. Just apply your SweetFX preset settings with the mediator then also activate Deband shader from CustomFX section.
Please Log in or Create an account to join the conversation.
- Cloudbill
Please Log in or Create an account to join the conversation.
- Aelius Maximus
Cloudbill wrote: JPulowski, is there any chance you could/would port your Deband script to work with MPC-HC hlsl scripting? I have been looking for a stand alone hlsl deband script for MPC-HC that actually works for a very, very long time?
ReShade can be injected into MPC-HC using ENB Injector
Please Log in or Create an account to join the conversation.
- Cloudbill
Aelius Maximus wrote:
ReShade can be injected into MPC-HC using ENB Injector
I'm only looking for one single shader script. I don't need or want any of what Reshade can do for video playback. Except of course, the deband shader. It would be needless overkill to use Reshade and a modified ENB injector just for a single shader script. Thanks for the suggestion though.
Please Log in or Create an account to join the conversation.
- crosire
Not necessarily overkill.Cloudbill wrote: I'm only looking for one single shader script. I don't need or want any of what Reshade can do for video playback. Except of course, the deband shader. It would be needless overkill to use Reshade and a modified ENB injector just for a single shader script. Thanks for the suggestion though.
Quick suggestion: You don't need the whole ReShade Framework. You can throw all that away and only use the Deband shader alone with ReShade (remember, ReShade is only the injector, it alone is very lightweight).
Take the "ReShade\CustomFX\Deband.h" file, rename it to "ReShade.fx", delete everything except for the ReShade DLL and put that file right next to it. Then open the file and paste the following at the top (to add the config and fix some variables that are otherwise part of the framework). That's it, now you only have the deband shader alone, ready to be injected into MPC-HC.
// Deband configuration
#define USE_DEBAND 1
#define DEBAND_RADIUS 32.0
#define DEBAND_THRESHOLD 0.017
#define DEBAND_SAMPLE_COUNT 8
#define DEBAND_OFFSET_MODE 3
#define DEBAND_DITHERING 1
// ReShade Framework stuff used in deband shader
#define RFX_Start_Enabled 1
#define RFX_pixelSize float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT)
#define RFX_ScreenSize float2(BUFFER_WIDTH, BUFFER_HEIGHT)
texture RFX_backbufferTex : COLOR;
sampler RFX_backbufferColor { Texture = RFX_backbufferTex; };
uniform float RFX_frametime < source = "frametime"; >;
void RFX_VS_PostProcess(uint id : SV_VertexID, out float4 pos : SV_Position, out float2 texcoord : TEXCOORD)
{
texcoord.x = (id == 2) ? 2.0 : 0.0; texcoord.y = (id == 1) ? 2.0 : 0.0;
pos = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}
Please Log in or Create an account to join the conversation.
- Cloudbill
crosire wrote:
Not necessarily overkill.Cloudbill wrote: I'm only looking for one single shader script. I don't need or want any of what Reshade can do for video playback. Except of course, the deband shader. It would be needless overkill to use Reshade and a modified ENB injector just for a single shader script. Thanks for the suggestion though.
Quick suggestion: You don't need the whole ReShade Framework. You can throw all that away and only use the Deband shader alone with ReShade (remember, ReShade is only the injector, it alone is very lightweight).
Take the "ReShade\CustomFX\Deband.h" file, rename it to "ReShade.fx", delete everything except for the ReShade DLL and put that file right next to it. Then open the file and paste the following at the top (to add the config and fix some variables that are otherwise part of the framework). That's it, now you only have the deband shader alone, ready to be injected into MPC-HC.// Deband configuration #define USE_DEBAND 1 #define DEBAND_RADIUS 32.0 #define DEBAND_THRESHOLD 0.017 #define DEBAND_SAMPLE_COUNT 8 #define DEBAND_OFFSET_MODE 3 #define DEBAND_DITHERING 1 // ReShade Framework stuff used in deband shader #define RFX_Start_Enabled 1 #define RFX_pixelSize float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT) #define RFX_ScreenSize float2(BUFFER_WIDTH, BUFFER_HEIGHT) texture RFX_backbufferTex : COLOR; sampler RFX_backbufferColor { Texture = RFX_backbufferTex; }; uniform float RFX_frametime < source = "frametime"; >; void RFX_VS_PostProcess(uint id : SV_VertexID, out float4 pos : SV_Position, out float2 texcoord : TEXCOORD) { texcoord.x = (id == 2) ? 2.0 : 0.0; texcoord.y = (id == 1) ? 2.0 : 0.0; pos = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); }
The question is, when does the injector inject the deband script? I assume it injects it after MPC-HC has already done what it needs to do. Things like pre-resizing shaders, resizing and post-resizing shaders. With a deband shader it needs to be initiated before resizing.
Please Log in or Create an account to join the conversation.
- crosire
I see. Yeah, it's the last thing to run.Cloudbill wrote: The question is, when does the injector inject the deband script? I assume it injects it after MPC-HC has already done what it needs to do. Things like pre-resizing shaders, resizing and post-resizing shaders. With a deband shader it needs to be initiated before resizing.
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
I would not suggest using the Deband shader with MPC-HC. Instead use madVR which has a higher quality deband shader already. Also other than MPC-HC, MPDN has its own deband shader.Cloudbill wrote: JPulowski, is there any chance you could/would port your Deband script to work with MPC-HC hlsl scripting? I have been looking for a stand alone hlsl deband script for MPC-HC that actually works for a very, very long time?
Please Log in or Create an account to join the conversation.
- Cloudbill
JPulowski wrote:
I would not suggest using the Deband shader with MPC-HC. Instead use madVR which has a higher quality deband shader already. Also other than MPC-HC, MPDN has its own deband shader.Cloudbill wrote: JPulowski, is there any chance you could/would port your Deband script to work with MPC-HC hlsl scripting? I have been looking for a stand alone hlsl deband script for MPC-HC that actually works for a very, very long time?
I actually use madVR for most of my video needs. I have a substantial collection of VHS/TIVO rips from 1995-2004. Now these files weren't very high quality to begin with and converting them to .AVI didn't help matters. They need a lot of post processing to clean them up and madVR simply doesn't offer the necessary post processing (Denoising mostly) yet. So I use a forked version of MPC-HC which offers multiple high quality resizers and up to 32 bit dithering. This deviated MPC-HC allows the use of hlsl scripts the same as the main branch. This is why I've been looking for a standalone debanding hlsl script that actually works and doesn't make a blurry mess of things.
Please Log in or Create an account to join the conversation.
- JPulowski
- Topic Author
In that case you are always free to use the original Deband shader which was designed for MPC-HC in the first place.Cloudbill wrote: I actually use madVR for most of my video needs. I have a substantial collection of VHS/TIVO rips from 1995-2004. Now these files weren't very high quality to begin with and converting them to .AVI didn't help matters. They need a lot of post processing to clean them up and madVR simply doesn't offer the necessary post processing (Denoising mostly) yet. So I use a forked version of MPC-HC which offers multiple high quality resizers and up to 32 bit dithering. This deviated MPC-HC allows the use of hlsl scripts the same as the main branch. This is why I've been looking for a standalone debanding hlsl script that actually works and doesn't make a blurry mess of things.
sampler s0 : register(s0);
float4 p0 : register(c0);
#define IMAGE_WIDTH (p0[0])
#define IMAGE_HEIGHT (p0[1])
#define RADIUS 16
#define THRESHOLD (3.0 / 256.0)
#define SAMPLE_COUNT 8 // 1 ... 8
//#define SKIP_THRESHOLD_TEST // just for testing
/*
OFFSET_MODE
1 = cross (axis aligned, fast)
2 = diagonal (45°, slower)
3 = box (fully random, much slower)
*/
#define OFFSET_MODE 1
#define OUTPUT_BOOST 1.0
#define OUTPUT_OFFSET 0.0
float rand(float2 pos)
{
return frac(sin(dot(pos.xy, float2(12.9898, 78.233))) * 43758.5453);
}
bool is_within_threshold(float3 original, float3 other)
{
return !any(max(abs(original - other) - float3(THRESHOLD, THRESHOLD, THRESHOLD), float3(0, 0, 0)));
}
float4 main(float2 pos0 : TEXCOORD0) : COLOR
{
float2 step = float2(1.0 / IMAGE_WIDTH, 1.0 / IMAGE_HEIGHT) * RADIUS;
float2 halfstep = step * 0.5;
// compute additional sample positions
float2 seed = pos0 + p0[3]; // no idea what p0[3] is exactly, but it changes every frame, which is what we need...
#if OFFSET_MODE == 1
float2 offset = float2(rand(seed), 0.0);
#elif OFFSET_MODE == 2
float2 offset = float2(rand(seed), 0.0);
offset.y = offset.x;
#elif OFFSET_MODE == 3
float2 offset = float2(rand(seed), rand(seed + float2(0.1, 0.2)));
#endif
float2 on[8] = {
float2( offset.x, offset.y) * step,
float2( offset.y, -offset.x) * step,
float2(-offset.x, -offset.y) * step,
float2(-offset.y, offset.x) * step,
float2( offset.x, offset.y) * halfstep,
float2( offset.y, -offset.x) * halfstep,
float2(-offset.x, -offset.y) * halfstep,
float2(-offset.y, offset.x) * halfstep,
};
float3 col0 = tex2D(s0, pos0).rgb;
float4 accu = float4(col0, 1.0);
for (int i = 0; i < SAMPLE_COUNT; i++)
{
float4 cn = float4(tex2D(s0, pos0 + on[i]).rgb, 1.0);
#ifndef SKIP_THRESHOLD_TEST
if (is_within_threshold(col0, cn.rgb))
#endif
accu += cn;
}
accu.rgb = accu.rgb / accu.a;
// boost to make it easier to inspect the effect's output
accu.rgb -= float3(OUTPUT_OFFSET, OUTPUT_OFFSET, OUTPUT_OFFSET);
accu.rgb *= OUTPUT_BOOST;
accu.rgb = clamp(accu.rgb, float3(0, 0, 0), float3(1, 1, 1));
return float4(accu.rgb, 1.0);
}
Please Log in or Create an account to join the conversation.
- Cloudbill
Please Log in or Create an account to join the conversation.
- Cloudbill
Please Log in or Create an account to join the conversation.
- Aelius Maximus
Cloudbill wrote: I couldn't see any difference when using Reshade as instructed by crosire. I perceived quite a difference with the shader you posted JPulowski, It doesn't complete blur everything but it still seems to indiscriminately blur a little bit too much for my taste. I guess I'll keep relying on high random dithering to help combat banding. Again, thanks for the help with a non-related gaming issue crosire and JPulowski..
It works, you're obviously not doing something right..
Please Log in or Create an account to join the conversation.