Jump to content

Help with converting VC trails shader


Nurupo

Recommended Posts

Hello,

I'm trying to implement the GTA VC Trails effect into MTA:SA. I try to use the hlsl code from skygfx (a popular mod for restore ps2 effect to GTA: SA PC) and load it in MTASA which fails to compile. the official WIKI says MTA:SA use HLSL shader which is identical to the skygfx.

Anyone have idea for how to convert it into MTA-SA?

Thanks

 vcTrails.hlsl (From SKYGFX) :

float4 main(uniform sampler2D Diffuse : register(s0),
            uniform float4 RGB1 : register(c0),
            uniform float4 RGB2 : register(c1),

            in float2 Tex0 : TEXCOORD0) : COLOR0
{
	// GTA VC trails
	float a = 30/255.0f;
	float4 doublec = saturate(RGB1*2);
	float4 dst = tex2D(Diffuse, Tex0);
	float4 prev = dst;
	for(int i = 0; i < 5; i++){
		float4 tmp = dst*(1-a) + prev*doublec*a;
		tmp += prev*RGB1;
		tmp += prev*RGB1;
		prev = saturate(tmp);
	}
	return prev;
}

vctrails.fx (the one i trying to use in MTA-SA) :

texture ScreenSource;
float BlurStrength;
float2 UVSize;

sampler TextureSampler = sampler_state
{
    Texture = <ScreenSource>;
	MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Wrap;
    AddressV = Wrap;
};
float4 main(uniform sampler2D Diffuse : register(s0),
            uniform float4 RGB1 : register(c0),
            uniform float4 RGB2 : register(c1),

            in float2 Tex0 : TEXCOORD0) : COLOR0
{
	// GTA VC trails
	float a = 30/255.0f;
	float4 doublec = saturate(RGB1*2);
	float4 dst = tex2D(Diffuse, Tex0);
	float4 prev = dst;
	for(int i = 0; i < 5; i++){
		float4 tmp = dst*(1-a) + prev*doublec*a;
		tmp += prev*RGB1;
		tmp += prev*RGB1;
		prev = saturate(tmp);
	}
	return prev;
}
 
technique BlurShader
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 main();
    }
}

ERROR MESSAGE:

WARNING: shader-test\vctrails.Lua:18: vctrails.fx(59,23): error X3013: 'main': function does not take 0 parameters @ 'dxCreateShader' [shaders/vctrails.fx]

 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...