solution to someones problem

  • Andy el gangster
  • Topic Author
More
2 years 10 months ago #1 by Andy el gangster solution to someones problem was created by Andy el gangster
So this guy created a code that interpolates frames, and here is his link:  reshade.me/forum/shader-troubleshooting/...osite-of-what-i-want
this is the code:#include "ReShade.fxh"
#include "ReShadeUI.fxh"
#include "DrawText.fxh"

texture2D firstFrameTex : COLOR;
texture2D secondFrameTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };
texture2D thirdFrameTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; };

sampler2D firstFrame { Texture = firstFrameTex; };
sampler2D secondFrame { Texture = secondFrameTex; };
sampler2D thirdFrame { Texture = thirdFrameTex; };

uniform float2 pingpong < source = "pingpong"; min = 0; max = 3; step = 1; smoothing = 0.0; >;

uniform float framecount < source = "framecount"; >;

void FullscreenTriangleVS(uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD0)
{
    texcoord.x = (id == 2) ? 2.0 : 0.0;
    texcoord.y = (id == 1) ? 2.0 : 0.0;
    position = float4(texcoord * float2(2, -2) + float2(-1, 1), 0, 1);
}

float4 DoFrameInterpolation(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float4 firstFrameColor = tex2D(firstFrame, texcoord);
    float4 secondFrameColor = tex2D(secondFrame, texcoord);
    float4 thirdFrameColor = tex2D(thirdFrame, texcoord);
    
    float4 currColor = float4(0f,0f,0f,1f);
    
    float fraction = 0.3;
    
    float res = 0;
    
    DrawText_Digit(float2(500.0, 500.0),32,1,texcoord,0,framecount,res);

    if ((framecount % 3) < 0.01f)
    {
        currColor = secondFrameColor;
    }
    else if ((framecount % 2) < 0.01f)
    {
        currColor = (thirdFrameColor - secondFrameColor) * fraction + secondFrameColor;
    }
    else
    {
        currColor = thirdFrameColor;
    }
    
    return currColor + res;
}

float4 PS_CopySecondFrame(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    return tex2D(firstFrame, texcoord);
}

float4 PS_CopyThirdFrame(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    return tex2D(secondFrame, texcoord);
}

technique MotionInterpolation <
    ui_label = "Motion interpolation";
    ui_tooltip =
        "Adds interpolated frames between 2 real frames by delaying everything by 1 real frame"
        "\n\nUnder the Creative Commons CC BY-SA 3.0 license"
        "\n(c) 2022 YouYouTheBoxx";
>
{
    pass ThirdFrameCopy
    {
        VertexShader = FullscreenTriangleVS;
        PixelShader = PS_CopyThirdFrame;
        RenderTarget = thirdFrameTex;
    }
    
    pass SecondFrameCopy
    {
        VertexShader = FullscreenTriangleVS;
        PixelShader = PS_CopySecondFrame;
        RenderTarget = secondFrameTex;
    }

    pass FrameInterpolate
    {    
        VertexShader = FullscreenTriangleVS;
        PixelShader = DoFrameInterpolation;
    }
}
basically he says that instead of adding frames, its taking away frames. is there any solution to his problem?

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