// GaussianBlur.fx // ####################### // ##### PARAMETERS ##### sampler TextureSampler : register(s0); #define SAMPLE_COUNT 7 const float2 SampleOffsets[SAMPLE_COUNT] = { {0.000000, 0.000000}, {0.002930, 0.000000}, {-0.002930,0.000000}, {0.006836, 0.000000}, {-0.006836,0.000000}, {0.010742, 0.000000}, {-0.010742,0.000000} }; float SampleWeights[SAMPLE_COUNT] = {0.160949, 0.155997, 0.155997, 0.142037, 0.142037,0.121491, 0.121491}; // ####################### // ##### PIXELSHADER ##### float4 PixelShader(float2 texCoord : TEXCOORD0) : COLOR0 { float4 c = 0; // Combine a number of weighted image filter taps. for (int i = 0; i < SAMPLE_COUNT; i++) { c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i]; } return c; } // ####################### // ##### TECHNIQUES ###### technique GaussianBlur { pass Pass1 { PixelShader = compile ps_2_0 PixelShader(); } }