Texture2D BlurTexture; SamplerState BlurSampler; cbuffer ScreenSizeBuffer { float screenHeight; float blurAmount; }; struct VS_to_PS { float4 position : SV_POSITION; float2 texCoord0 : TEXCOORD0; }; static float PixelKernel[9] = { -4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0 }; static float BlurWeights[9] = { 0.02242, 0.04036, 0.12332, 0.20179, 0.22422, 0.20179, 0.12332, 0.04036, 0.02242 }; float4 VerticalBlurPixelShader(VS_to_PS input) : SV_TARGET { float4 color = float4(0.0, 0.0, 0.0, 0.0); float texelSize = 1.0 / screenHeight; for(int i = 0; i < 9; i++) { color += BlurTexture.Sample(BlurSampler, input.texCoord0 + float2(0.0, texelSize * PixelKernel[i] * blurAmount)) * BlurWeights[i]; } color.a = 1.0f; return color; }