Welcome, Guest.
Username: Password: Remember me

TOPIC: integrate a color correction shader into reshade.

integrate a color correction shader into reshade. 1 year 3 months ago #1

how can i integrate this shader into reshade?

Warning: Spoiler! [ Click to expand ]


sorry if i had to ask the question elsewhere, but i would like to use it in my games.
i found it some years ago on AVSforum i think, and used it for MPC-HC back in the days and just found it on my HDD, it came as a Excel document.


ciao
sucht
Last Edit: 1 year 3 months ago by sucht. Reason: corrected the shader code.
The administrator has disabled public write access.

integrate a color correction shader into reshade. 1 year 3 months ago #2

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 609
  • Thank you received: 716
That matrix is weird. it mixes commas as numeric components and to separate numbers so I had a little of guesswork. But the final shader actually seems to do nothing at all because the color changes done with this matrix are too low to notice. It's like this "double your age. Add 10. Subtract your age. Subtract 10. That's your age" it is some math but in the end everything cancels itself.
Last Edit: 1 year 3 months ago by Marty McFly.
The administrator has disabled public write access.

integrate a color correction shader into reshade. 1 year 3 months ago #3

after calibrating my TV, and put in the numbers i got after calibrating into the excel file, it changed it into these long numbers you see in the shader code, and then i put this code into MPC-HC and it did work quite good.

but like i said i just found it after some years and thought i ask the PROS ;)

thank you for your time, and sorry for my english ;)

edit: i actually found the link to this on AVSForum
oh and the problem with the commas was made by the excel document giving me the final shader, i gave the shader a go and saw immediately what you meant(MPC-HC could not compile the shader). *sorry for that*
Last Edit: 1 year 3 months ago by sucht.
The administrator has disabled public write access.

integrate a color correction shader into reshade. 1 year 3 months ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2437
  • Thank you received: 1385
Pretty much just copied your code:
sampler s0 : COLOR;

static float4x4 r2r =
{
1.40412014946264, -0.432440054809338, -0.00654217784142042, 0,
-0.0220921261148502, 1.02509523355613, 0.00195869854351983, 0,
-0.00551581309739748, 0.03912862385936, 1.01991796272781, 0,
0, 0, 0, 0
};

float4 main(float4 pos : POSITION, float2 tex : TEXCOORD0) : COLOR
{
    float4 c0 = tex2D(s0, tex);
    c0 = pow(c0, 1/0.45);
    c0 = mul(r2r, c0);
    c0 = saturate(c0);
    c0 = pow(c0, 0.45);

    return c0;
}

technique MyColorCorrectionShader
{
    pass
    {
        VertexShader = ...; // Use the vertex shader from the ReShade Framework for instance
        PixelShader = main;
    }
}
Cheers, crosire =)
Last Edit: 1 year 3 months ago by crosire.
The administrator has disabled public write access.
The following user(s) said Thank You: sucht

integrate a color correction shader into reshade. 1 year 3 months ago #5

crosire wrote:
Pretty much just copied your code:
sampler s0 : COLOR;

static float4x4 r2r =
{
1.40412014946264, -0.432440054809338, -0.00654217784142042, 0,
-0.0220921261148502, 1.02509523355613, 0.00195869854351983, 0,
-0.00551581309739748, 0.03912862385936, 1.01991796272781, 0,
0, 0, 0, 0
};

float4 main(float4 pos : POSITION, float2 tex : TEXCOORD0) : COLOR
{
    float4 c0 = tex2D(s0, tex);
    c0 = pow(c0, 1/0.45);
    c0 = mul(r2r, c0);
    c0 = saturate(c0);
    c0 = pow(c0, 0.45);

    return c0;
}

technique MyColorCorrectionShader
{
    pass
    {
        VertexShader = ...; // Use the vertex shader from the ReShade Framework for instance
        PixelShader = main;
    }
}

thank you very much kind Sir ;)
The administrator has disabled public write access.