Welcome, Guest.
Username: Password: Remember me

TOPIC: Deband

Deband 4 years 5 months ago #21

omg, thank you so much! :D
The administrator has disabled public write access.

Deband 4 years 5 months ago #22

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.
SunBroDave wrote:
Wicked Sick wrote:
Guys, can other effects introduce banding?
Yes. Use SweetFX's Dither effect to lessen banding from other effects.
Yes, every effect might 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.
The administrator has disabled public write access.

Deband 4 years 5 months ago #23

  • Wicked Sick
  • Wicked Sick's Avatar
  • Offline
  • Die young or suffer (Forgive my poor English)
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?
Finding relief somewhere between a tree's branch and its shade.
The administrator has disabled public write access.

Deband 4 years 5 months ago #24

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?
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.

And no, there shouldn't be any difference in performance when changing shader order.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick

Deband 4 years 5 months ago #25

  • Wicked Sick
  • Wicked Sick's Avatar
  • Offline
  • Die young or suffer (Forgive my poor English)
hmmmm Thank you. I didn't know that. I never worried about changing the order. Later, I will try changing the order while playing to see what happens.
Finding relief somewhere between a tree's branch and its shade.
The administrator has disabled public write access.

Deband 4 years 4 months ago #26

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!
The administrator has disabled public write access.

Deband 4 years 3 months ago #27

This shader is amazing.

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.
The administrator has disabled public write access.
The following user(s) said Thank You: JPulowski

Deband 4 years 3 months ago #28

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!
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.

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.
The administrator has disabled public write access.
The following user(s) said Thank You: Arioch

Deband 4 years 3 months ago #29

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?
The administrator has disabled public write access.

Deband 4 years 3 months ago #30

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
The administrator has disabled public write access.
The following user(s) said Thank You: Cloudbill

Deband 4 years 3 months ago #31

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.
Last Edit: 4 years 3 months ago by Cloudbill.
The administrator has disabled public write access.

Deband 4 years 3 months ago #32

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.
Not necessarily overkill.
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);
}
Cheers, crosire =)
Last Edit: 4 years 3 months ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: Cloudbill

Deband 4 years 3 months ago #33

crosire wrote:
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.
Not necessarily overkill.
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.
The administrator has disabled public write access.

Deband 4 years 3 months ago #34

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.
I see. Yeah, it's the last thing to run.
Cheers, crosire =)
The administrator has disabled public write access.

Deband 4 years 3 months ago #35

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 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.
The administrator has disabled public write access.

Deband 4 years 3 months ago #36

JPulowski wrote:
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 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.

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.
The administrator has disabled public write access.

Deband 4 years 3 months ago #37

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.
In that case you are always free to use the original Deband shader which was designed for MPC-HC in the first place.
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);
}
The administrator has disabled public write access.
The following user(s) said Thank You: Cloudbill

Deband 4 years 3 months ago #38

Hopefully it won't make things a blurry mess. I wasn't even aware that they had a deband shader for MPC-HC. If it is the same one I've run into from time to time it will make a blurry mess. I'll check it when I get home in about an hour and let you know. Thanks for your patience and help.
The administrator has disabled public write access.

Deband 4 years 3 months ago #39

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..
The administrator has disabled public write access.

Deband 4 years 3 months ago #40

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..
The administrator has disabled public write access.