My own Shader is not working

  • jensen_dxmd
  • Topic Author
More
1 year 11 months ago #1 by jensen_dxmd My own Shader is not working was created by jensen_dxmd
Hello everyone, I'm a beginner modder and recently I got the idea to create my own shader for Reshade and I have a problem with the code, apparently Reshade gives errors, below I will paste the code itself and in which lines of the code what are the errors, I will be very grateful for any help.

Shader code:
#include "ReShade.fxh"

float3 CalculateReflection(float3 viewDir, float3 normal)
{
    return reflect(viewDir, normal);
}

float3 CalculateLighting(float3 normal)
{
    // Просте біле освітлення
    return float3(1.0, 1.0, 1.0);
}

float4 mainImage(Reshade::SV_Input V) : SV_Target
{
    float4 color = tex2D(ReShade::BackBuffer, V.Texcoord);

    float3 viewDir = normalize(V.Ray);
    float3 normal = normalize(V.Normal);

    // Розрахунок відбиття
    float3 reflection = CalculateReflection(viewDir, normal);

    // Розрахунок освітлення
    float3 lighting = CalculateLighting(normal);

    // Об'єднання відбиття та освітлення
    float3 finalColor = reflection * lighting;

    // Комбінування з оригінальним кольором
    return float4(finalColor, color.a);
}

technique MainImage
{
    pass
    {
        SetVertexShader(CompileShader(vs_5_0, ReShade::VS_RenderScreenQuad()));
        SetPixelShader(CompileShader(ps_5_0, mainImage()));
    }
}

lines with errors:
number 14 error X3000: syntax error: unexpected ‘identifier’, expected parameter type |
number 16 error X3004: undeclared identifier 'V'
number 38 error X3000: syntax error: unexpected '(', expected '=

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

  • YF
More
1 year 11 months ago #2 by YF Replied by YF on topic My own Shader is not working

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