6.4.1 Conflicts with my custom shader.

  • Gotthemshaders
  • Topic Author
More
6 months 4 weeks ago - 6 months 4 weeks ago #1 by Gotthemshaders 6.4.1 Conflicts with my custom shader. was created by Gotthemshaders
I wrote a custom shader. And the latest ReShade ( Version 6.4.1 ) 
will run it but mixes up the order of the UI fields for Lut name and size,
when a lut name or size value is applied with the Enter key. 
The lut name will drop two rows down, and the size value fields up to the top. 
A Reload button press will correct the visual behavior allowing the size field to be applied next. Only for the behavior to happen again after Enter is pressed. etc

I returned to 6.3.1 and my lut runs without this behavior. 

Here is the shader: It runs five Luts at one time. 


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ReShade effect file: MASS-LUT.FX
// Ensures definitions appear in order: Name, Size, Amount
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#ifndef fLUT1_1Name
  #define fLUT1_1Name "lut.png"
#endif
#ifndef fLUT1_2TileSize
  #define fLUT1_2TileSize 32
#endif
#ifndef fLUT1_3TileAmount
  #define fLUT1_3TileAmount 32
#endif

#ifndef fLUT2_1Name
  #define fLUT2_1Name "lut.png"
#endif
#ifndef fLUT2_2TileSize
  #define fLUT2_2TileSize 32
#endif
#ifndef fLUT2_3TileAmount
  #define fLUT2_3TileAmount 32
#endif

#ifndef fLUT3_1Name
  #define fLUT3_1Name "lut.png"
#endif
#ifndef fLUT3_2TileSize
  #define fLUT3_2TileSize 32
#endif
#ifndef fLUT3_3TileAmount
  #define fLUT3_3TileAmount 32
#endif

#ifndef fLUT4_1Name
  #define fLUT4_1Name "lut.png"
#endif
#ifndef fLUT4_2TileSize
  #define fLUT4_2TileSize 32
#endif
#ifndef fLUT4_3TileAmount
  #define fLUT4_3TileAmount 32
#endif

#ifndef fLUT5_1Name
  #define fLUT5_1Name "lut.png"
#endif
#ifndef fLUT5_2TileSize
  #define fLUT5_2TileSize 32
#endif
#ifndef fLUT5_3TileAmount
  #define fLUT5_3TileAmount 32
#endif

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include "ReShadeUI.fxh"

uniform float fLUT1_AmountChroma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 1 Chroma Amount";
> = 0.0;

uniform float fLUT1_AmountLuma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 1 Luma Amount";
> = 0.0;

uniform float fLUT2_AmountChroma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 2 Chroma Amount";
> = 0.0;

uniform float fLUT2_AmountLuma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 2 Luma Amount";
> = 0.0;

uniform float fLUT3_AmountChroma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 3 Chroma Amount";
> = 0.0;

uniform float fLUT3_AmountLuma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 3 Luma Amount";
> = 0.0;

uniform float fLUT4_AmountChroma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 4 Chroma Amount";
> = 0.0;

uniform float fLUT4_AmountLuma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 4 Luma Amount";
> = 0.0;

uniform float fLUT5_AmountChroma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 5 Chroma Amount";
> = 0.0;

uniform float fLUT5_AmountLuma <
    ui_type = "slider";
    ui_min = 0.0; ui_max = 1.0;
    ui_label = "LUT 5 Luma Amount";
> = 0.0;

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include "ReShade.fxh"

//
LUT #1
texture texLUT1 < source = fLUT1_1Name; >
{
    Width  = fLUT1_2TileSize * fLUT1_3TileAmount;
    Height = fLUT1_2TileSize;
    Format = RGBA8;
};
sampler SamplerLUT1 { Texture = texLUT1; };

//
LUT #2
texture texLUT2 < source = fLUT2_1Name; >
{
    Width  = fLUT2_2TileSize * fLUT2_3TileAmount;
    Height = fLUT2_2TileSize;
    Format = RGBA8;
};
sampler SamplerLUT2 { Texture = texLUT2; };

//
LUT #3
texture texLUT3 < source = fLUT3_1Name; >
{
    Width  = fLUT3_2TileSize * fLUT3_3TileAmount;
    Height = fLUT3_2TileSize;
    Format = RGBA8;
};
sampler SamplerLUT3 { Texture = texLUT3; };

//
LUT #4
texture texLUT4 < source = fLUT4_1Name; >
{
    Width  = fLUT4_2TileSize * fLUT4_3TileAmount;
    Height = fLUT4_2TileSize;
    Format = RGBA8;
};
sampler SamplerLUT4 { Texture = texLUT4; };

//
LUT #5
texture texLUT5 < source = fLUT5_1Name; >
{
    Width  = fLUT5_2TileSize * fLUT5_3TileAmount;
    Height = fLUT5_2TileSize;
    Format = RGBA8;
};
sampler SamplerLUT5 { Texture = texLUT5; };

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Blending: For each pass, as in LUT.txt, we normalize color & LUT
// for chroma interpolation, and blend magnitudes for luma.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

void PS_MultiLUT_Apply(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 res : SV_Target0)
{
    float4 color = tex2D(ReShade::BackBuffer, texcoord);

    //
LUT #1
    float2 ts1 = 1.0 / fLUT1_2TileSize;
    ts1.x /= fLUT1_3TileAmount;
    float3 coord1 = float3(
        (color.xy * fLUT1_2TileSize - color.xy + 0.5) * ts1.xy,
        color.z * fLUT1_2TileSize - color.z
    );
    float lerp1 = frac(coord1.z);
    coord1.x += (coord1.z - lerp1) * ts1.y;
    float3 lut1 = lerp(
        tex2D(SamplerLUT1, coord1.xy).xyz,
        tex2D(SamplerLUT1, float2(coord1.x + ts1.y, coord1.y)).xyz,
        lerp1
    );
    float3 color1 = lerp(normalize(color.xyz), normalize(lut1), fLUT1_AmountChroma)
                  * lerp(length(color.xyz), length(lut1), fLUT1_AmountLuma);

    //
LUT #2
    float2 ts2 = 1.0 / fLUT2_2TileSize;
    ts2.x /= fLUT2_3TileAmount;
    float3 coord2 = float3(
        (color1.xy * fLUT2_2TileSize - color1.xy + 0.5) * ts2.xy,
        color1.z * fLUT2_2TileSize - color1.z
    );
    float lerp2 = frac(coord2.z);
    coord2.x += (coord2.z - lerp2) * ts2.y;
    float3 lut2 = lerp(
        tex2D(SamplerLUT2, coord2.xy).xyz,
        tex2D(SamplerLUT2, float2(coord2.x + ts2.y, coord2.y)).xyz,
        lerp2
    );
    float3 color2 = lerp(normalize(color1), normalize(lut2), fLUT2_AmountChroma)
                  * lerp(length(color1), length(lut2), fLUT2_AmountLuma);

    //
LUT #3
    float2 ts3 = 1.0 / fLUT3_2TileSize;
    ts3.x /= fLUT3_3TileAmount;
    float3 coord3 = float3(
        (color2.xy * fLUT3_2TileSize - color2.xy + 0.5) * ts3.xy,
        color2.z * fLUT3_2TileSize - color2.z
    );
    float lerp3 = frac(coord3.z);
    coord3.x += (coord3.z - lerp3) * ts3.y;
    float3 lut3 = lerp(
        tex2D(SamplerLUT3, coord3.xy).xyz,
        tex2D(SamplerLUT3, float2(coord3.x + ts3.y, coord3.y)).xyz,
        lerp3
    );
    float3 color3 = lerp(normalize(color2), normalize(lut3), fLUT3_AmountChroma)
                  * lerp(length(color2), length(lut3), fLUT3_AmountLuma);

    //
LUT #4
    float2 ts4 = 1.0 / fLUT4_2TileSize;
    ts4.x /= fLUT4_3TileAmount;
    float3 coord4 = float3(
        (color3.xy * fLUT4_2TileSize - color3.xy + 0.5) * ts4.xy,
        color3.z * fLUT4_2TileSize - color3.z
    );
    float lerp4 = frac(coord4.z);
    coord4.x += (coord4.z - lerp4) * ts4.y;
    float3 lut4 = lerp(
        tex2D(SamplerLUT4, coord4.xy).xyz,
        tex2D(SamplerLUT4, float2(coord4.x + ts4.y, coord4.y)).xyz,
        lerp4
    );
    float3 color4 = lerp(normalize(color3), normalize(lut4), fLUT4_AmountChroma)
                  * lerp(length(color3), length(lut4), fLUT4_AmountLuma);

    //
LUT #5
    float2 ts5 = 1.0 / fLUT5_2TileSize;
    ts5.x /= fLUT5_3TileAmount;
    float3 coord5 = float3(
        (color4.xy * fLUT5_2TileSize - color4.xy + 0.5) * ts5.xy,
        color4.z * fLUT5_2TileSize - color4.z
    );
    float lerp5 = frac(coord5.z);
    coord5.x += (coord5.z - lerp5) * ts5.y;
    float3 lut5 = lerp(
        tex2D(SamplerLUT5, coord5.xy).xyz,
        tex2D(SamplerLUT5, float2(coord5.x + ts5.y, coord5.y)).xyz,
        lerp5
    );
    float3 color5 = lerp(normalize(color4), normalize(lut5), fLUT5_AmountChroma)
                  * lerp(length(color4), length(lut5), fLUT5_AmountLuma);

    res.xyz = color5;
    res.w   = 1.0;
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

technique MultiLUT
{
    pass MultiLUT_Apply
    {
        VertexShader = PostProcessVS;
        PixelShader  = PS_MultiLUT_Apply;
    }
}
 
Last edit: 6 months 4 weeks ago by Gotthemshaders.

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

  • crosire
More
6 months 4 weeks ago #2 by crosire Replied by crosire on topic 6.4.1 Conflicts with my custom shader.
Fixed by github.com/crosire/reshade/commit/9bfc3c...9c127c218338197d0420 . Didn't affect functionality though, just how the list was sorted.

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

  • Gotthemshaders
  • Topic Author
More
6 months 3 weeks ago #3 by Gotthemshaders Replied by Gotthemshaders on topic 6.4.1 Conflicts with my custom shader.
Im not a programmer, so I guess ill wait until that gets pushed to the next update. Thanks.

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