sampler2D Tex0; struct PS_INPUT{ float2 Tex : TEXCOORD0; }; struct PS_OUTPUT{ float4 Color : COLOR; }; //#define HORIZONTAL #ifdef HORIZONTAL static float2 TexelKernel[5] = { //{ -5 - 0.12642628936558649018712916476495f, 0 }, { -3 - 0.20842662795904816318967247795673f, 0 }, { -1 - 0.34364295330989075911902881846018f, 0 }, { 0, 0 }, { 1 + 0.34364295330989075911902881846018f, 0 }, { 3 + 0.20842662795904816318967247795673f, 0 }, //{ 5 + 0.12642628936558649018712916476495f, 0 }, }; #endif #ifdef VERTICAL static float2 TexelKernel[5] = { //{ 0, -5 - 0.12642628936558649018712916476495f }, { 0, -3 - 0.20842662795904816318967247795673f }, { 0, -1 - 0.34364295330989075911902881846018f }, { 0, 0 }, { 0, 1 + 0.34364295330989075911902881846018f }, { 0, 3 + 0.20842662795904816318967247795673f }, //{ 0, 5 + 0.12642628936558649018712916476495f }, }; #endif // (b - a) / (2 * a) + 0.5 = texeloffset static float BlurWeights[5] = { //0.008764 + 0.002216, 0.064759 + 0.026995, 0.176033 + 0.120985, 0.199471, // midden 0.176033 + 0.120985, 0.064759 + 0.026995, //0.008764 + 0.002216, }; float InvTexSize; PS_OUTPUT main(const PS_INPUT Input){ float4 Color = 0; for (int i = 0; i < 5; i++){ Color += tex2D(Tex0, Input.Tex + (TexelKernel[i] * InvTexSize)) * BlurWeights[i]; } PS_OUTPUT Out; Out.Color = Color; return Out; }