hello everyone. I hope all is well.
I'm telling you that I have a problem with the darkshader distort.fx call effect. When playing for several hours, the effect drops its framerate drastically to approximately 15fps and the game continues to be at a stable 60fps. The funniest thing is that if I restart the PC, it resolves itself, but after hours go back to the same thing. It is as if a memory cache was put together. thanks for your help. Greetings.
string Description = "This shader takes two textures and distorts one with the other, using the models UV coordinates";
string Thumbnail = "Distort.png";
float4x4 WorldViewProj : WorldViewProjection;
float fTime : Time;
float distortSize
<
string UIWidget = "slider";
float UIMax = 0.1;
float UIMin = 0.0;
float UIStep = 0.001;
> = 0.200000;
float distortSpeed
<
string UIWidget = "slider";
float UIMax = 0.2;
float UIMin = 0.0;
float UIStep = 0.01;
> = 0.200000;
texture BaseTex : DIFFUSE
<
string ResourceName = "nave-pr.png";
string Type = "2D";
>;
sampler texture1 = sampler_state
{
Texture = <BaseTex>;
MinFilter = Anisotropic;
MagFilter = Linear;
MipFilter = none;
AddressU = Wrap;
AddressV = Wrap;
};
texture DistortTex : DIFFUSE
<
string ResourceName = "nRHPu.png";
string Type = "2D";
>;
sampler distortSmp = sampler_state
{
Texture = <DistortTex>;
MinFilter = Anisotropic;
MagFilter = Linear;
MipFilter = none;
AddressU = Wrap;
AddressV = Wrap;
};
struct app_in
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
struct vs_out
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
vs_out DefaultVertexShader( app_in IN )
{
vs_out OUT;
OUT.pos = mul( IN.pos, WorldViewProj );
OUT.uv = IN.uv;
return OUT;
}
float4 DefaultPixelShader( vs_out IN ) : COLOR
{
//calculate an offset value using the variable and time values
float2 offset = float2( sin(fTime*distortSpeed), cos(fTime*distortSpeed) );
//offset the uv co-odinate by the offset value and read the texture
float2 uv = IN.uv + (tex2D(distortSmp, IN.uv + offset).xy - 0.25) * distortSize;
return tex2D( texture1, uv );
}
technique MyShader
<
>
{
pass p0
{
VertexShader = compile vs_2_0 DefaultVertexShader( );
PixelShader = compile ps_2_0 DefaultPixelShader( );
}
}