Trying to create a a shader, error X3004

  • WinterDepression
  • Topic Author
More
1 year 10 months ago - 1 year 10 months ago #1 by WinterDepression Trying to create a a shader, error X3004 was created by WinterDepression
Hello, I'm trying to get ChatGPT to write a shader for me lol, 

The shade is supposed to apply the smart blur effect: "Smart blur is a type of image filtering or blurring technique that is used to reduce noise or blur specific parts of an image while keeping other parts sharp."

But it is not going so well. Just to be clear I don't know anything about coding.
Getting this compiler error X3004: undeclared identifier 'ReShade::BackBufferTextureSize'
// Smart Blur effect using Reshade FX language
// By ChatGPT

#include "ReShade.fxh"

float4 SmartBlurPass(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
    float blurRadius = 5.0f;
    float3 result = float3(0.0f, 0.0f, 0.0f);
    float totalWeight = 0.0f;
    float2 pixelSize = 1.0f / ReShade::BackBufferTextureSize;

    [loop]
    for (float i = -blurRadius; i <= blurRadius; i++)
    {
        for (float j = -blurRadius; j <= blurRadius; j++)
        {
            float2 offset = float2(i, j) * pixelSize;
            float4 color = tex2D(ReShade::BackBuffer, texcoord + offset);
            float weight = exp(-dot(offset, offset) * 100.0f);

            result += color.rgb * weight;
            totalWeight += weight;
        }
    }

    result /= totalWeight;
    return float4(result, 1.0f);
}

technique SmartBlur
{
    pass
    {
        PixelShader = SmartBlurPass;
    }
}



So I guess humans are still superior, would you guys have any ideas of how to fix this?
Last edit: 1 year 10 months ago by WinterDepression.

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

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.