anyone know coding, i got this from a fx file. i opened the fx file with nvidea fx composer. i dont understand any of the coding there but maybe someone else does.
Code:
/*
Copyright Doobic entertainment Corporation 2006
Title : Blur
Information : Gaussian focus blur
Compile VS 2.0, PS 2.0
Last Date : 2006 / 5 / 19
Author : Jung Hwan Ji (Russiac)
*/
texture tTexture;
texture tBlurTexture;
texture tDotTexture;
float2 vViewportSize;
sampler2D g_Screen = sampler_state
{
Texture = <tTexture>;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
sampler2D g_BlurScreen = sampler_state
{
Texture = <tBlurTexture>;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
sampler2D g_DotTexture = sampler_state
{
Texture = <tDotTexture>;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VS_OUTPUT {
float4 Pos : POSITION0;
float2 Tex : TEXCOORD0;
};
VS_OUTPUT CommonVS(float3 Pos : POSITION0)
{
VS_OUTPUT output = (VS_OUTPUT)0;
float4 outPos = float4(Pos, 1.0f);
outPos.xy = sign(outPos.xy);
output.Pos = float4(outPos.xy, 0.0f, 1.0f);
output.Tex = 0.5f * outPos.xy + 0.5f;
output.Tex.y = 1.0f - output.Tex.y;
return output;
}
float4 DownSamplingPS(float2 Tex : TEXCOORD0) :COLOR0
{
float2 texCoordSample = 0;
float4 cOut;
float2 pixelSize = 1.0f / float2(vViewportSize.x, vViewportSize.y);
texCoordSample.x = Tex.x - pixelSize.x;
texCoordSample.y = Tex.y + pixelSize.y;
cOut = tex2D(g_Screen, texCoordSample);
texCoordSample.x = Tex.x + pixelSize.x;
texCoordSample.y = Tex.y + pixelSize.y;
cOut += tex2D(g_Screen, texCoordSample);
texCoordSample.x = Tex.x + pixelSize.x;
texCoordSample.y = Tex.y - pixelSize.y;
cOut += tex2D(g_Screen, texCoordSample);
texCoordSample.x = Tex.x - pixelSize.x;
texCoordSample.y = Tex.y - pixelSize.y;
cOut += tex2D(g_Screen, texCoordSample);
return cOut * 0.25f;
}
float4 Gaussian1PS(float2 Tex : TEXCOORD0) :COLOR0
{
float2 texCoordSample = 0;
float4 cOut;
float2 pixelSize = 8.0f / float2(vViewportSize.x, vViewportSize.y);
cOut = 0.5f * tex2D(g_BlurScreen, Tex);
texCoordSample.x = Tex.x;
texCoordSample.y = Tex.y + pixelSize.y;
cOut += 0.25f * tex2D(g_BlurScreen, texCoordSample);
texCoordSample.y = Tex.y - pixelSize.y;
cOut += 0.25f * tex2D(g_BlurScreen, texCoordSample);
return cOut;
}
float4 Gaussian2PS(float2 Tex : TEXCOORD0) :COLOR0
{
float2 texCoordSample = 0;
float4 cOut;
float2 pixelSize = 8.0f / float2(vViewportSize.x, vViewportSize.y);
cOut = 0.5f * tex2D(g_Screen, Tex);
texCoordSample.y = Tex.y;
texCoordSample.x = Tex.x + pixelSize.x;
cOut += 0.25f * tex2D(g_Screen, texCoordSample);
texCoordSample.x = Tex.x - pixelSize.x;
cOut += 0.25f * tex2D(g_Screen, texCoordSample);
return cOut;
}
float4 MurgePS(float2 Tex : TEXCOORD0) :COLOR0
{
float4 cOut;
float4 DotColor = tex2D(g_DotTexture, Tex);
float4 SrcColor = tex2D(g_Screen, Tex);
float4 BlurColor = tex2D(g_BlurScreen, Tex);
cOut = SrcColor * DotColor.a;
cOut += BlurColor * (1.0f - DotColor.a);
return cOut;
}
//-----------------------------------------------------------------------------------------
// Techniques
//-----------------------------------------------------------------------------------------
technique Blur
{
pass P0
{
ZWriteEnable = false;
ZEnable = false;
Lighting = false;
VertexShader = compile vs_2_0 CommonVS();
PixelShader = compile ps_2_0 DownSamplingPS();
}
pass P1
{
ZWriteEnable = false;
ZEnable = false;
Lighting = false;
VertexShader = compile vs_2_0 CommonVS();
PixelShader = compile ps_2_0 Gaussian1PS();
}
pass P2
{
ZWriteEnable = false;
ZEnable = false;
Lighting = false;
VertexShader = compile vs_2_0 CommonVS();
PixelShader = compile ps_2_0 Gaussian2PS();
}
pass P3
{
ZWriteEnable = false;
ZEnable = false;
Lighting = false;
VertexShader = compile vs_2_0 CommonVS();
PixelShader = compile ps_2_0 MurgePS();
}
}