1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| sampler ColorMapSampler : register(s0);
float2 center;
float time;
float3 shockParams = float3(10, 0.8, 0.1);
float4 PixelShaderFunction(float2 texCoord: TEXCOORD0) : COLOR
{
float2 tmpTexCoord = texCoord.xy;
float len = length(center - tmpTexCoord);
if ((len <= (time + shockParams.z)) &&
(len >= (time - shockParams.z)))
{
float diff = (len - time);
float powDiff = 1.0 - pow(abs(diff*shockParams.x),
shockParams.y);
float diffTime = diff * powDiff;
float2 diffUV = normalize(tmpTexCoord - center);
tmpTexCoord = (diffUV * diffTime);
return float4(tmpTexCoord.x, tmpTexCoord.y, 0, 0);
}
return float4(0, 0, 0, 0);
}
technique
{
pass p1
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
} |
Partager