http://www.embege.com/gauss/
sampler2D input : register(s0);
// new HLSL shader
// modify the comment parameters to reflect your shader parameters
/// <summary>Explain the purpose of this variable.</summary>
/// <minValue>1, 1/minValue>
/// <maxValue>1024, 1024</maxValue>
/// <defaultValue>599, 124</defaultValue>
float2 InputSize : register(C0);
static const float kernel[441] = {
{
0.0001253219113395547, 0.00018325629967027186, 0.000257465496677347, 0.00034754206833684524, 0.0004507377648081042, 0.0005616538403243442, 0.0006724217297003478, 0.0007734690974565646, 0.0008548155525392126, 0.0009076743942415001, 0.0009260106333131518, 0.0009076743942415001, 0.0008548155525392126, 0.0007734690974565646, 0.0006724217297003478, 0.0005616538403243442, 0.0004507377648081042, 0.00034754206833684524, 0.000257465496677347, 0.00018325629967027186, 0.0001253219113395547,
0.00018325629967027186, 0.000267972862924577, 0.00037648782810231063, 0.0005082054107090616, 0.0006591068873549146, 0.0008212977553028339, 0.0009832719329415178, 0.0011310319416143256, 0.0012499836092867847, 0.0013272782789233823, 0.00135409107874604, 0.0013272782789233823, 0.0012499836092867847, 0.0011310319416143256, 0.0009832719329415178, 0.0008212977553028339, 0.0006591068873549146, 0.0005082054107090616, 0.00037648782810231063, 0.000267972862924577, 0.00018325629967027186,
0.000257465496677347, 0.00037648782810231063, 0.0005289456669688587, 0.0007140019672870738, 0.0009260106333131518, 0.001153880302447998, 0.001381445533054985, 0.0015890406012215013, 0.0017561614601114424, 0.0018647564199807886, 0.0019024269984878957, 0.0018647564199807886, 0.0017561614601114424, 0.0015890406012215013, 0.001381445533054985, 0.001153880302447998, 0.0009260106333131518, 0.0007140019672870738, 0.0005289456669688587, 0.00037648782810231063, 0.000257465496677347,
0.00034754206833684524, 0.0005082054107090616, 0.0007140019672870738, 0.0009638018441690448, 0.0012499836092867847, 0.0015575754891478846, 0.0018647564199807886, 0.0021449804511547003, 0.0023705700144569524, 0.0025171578774949516, 0.002568007839679253, 0.0025171578774949516, 0.0023705700144569524, 0.0021449804511547003, 0.0018647564199807886, 0.0015575754891478846, 0.0012499836092867847, 0.0009638018441690448, 0.0007140019672870738, 0.0005082054107090616, 0.00034754206833684524,
0.0004507377648081042, 0.0006591068873549146, 0.0009260106333131518, 0.0012499836092867847, 0.0016211413507230966, 0.0020200665141290397, 0.002418458705376228, 0.002781889682412439, 0.003074463574296922, 0.003264577784210943, 0.0033305266300735804, 0.003264577784210943, 0.003074463574296922, 0.002781889682412439, 0.002418458705376228, 0.0020200665141290397, 0.0016211413507230966, 0.0012499836092867847, 0.0009260106333131518, 0.0006591068873549146, 0.0004507377648081042,
0.0005616538403243442, 0.0008212977553028339, 0.001153880302447998, 0.0015575754891478846, 0.0020200665141290397, 0.0025171578774949516, 0.003013585116655789, 0.003466448000315246, 0.0038310175189698874, 0.004067914412097752, 0.004150091734336279, 0.004067914412097752, 0.0038310175189698874, 0.003466448000315246, 0.003013585116655789, 0.0025171578774949516, 0.0020200665141290397, 0.0015575754891478846, 0.001153880302447998, 0.0008212977553028339, 0.0005616538403243442,
0.0006724217297003478, 0.0009832719329415178, 0.001381445533054985, 0.0018647564199807886, 0.002418458705376228, 0.003013585116655789, 0.003607916426905765, 0.004150091734336279, 0.004586560692134574, 0.004870177765856866, 0.004968561882895685, 0.004870177765856866, 0.004586560692134574, 0.004150091734336279, 0.003607916426905765, 0.003013585116655789, 0.002418458705376228, 0.0018647564199807886, 0.001381445533054985, 0.0009832719329415178, 0.0006724217297003478,
0.0007734690974565646, 0.0011310319416143256, 0.0015890406012215013, 0.0021449804511547003, 0.002781889682412439, 0.003466448000315246, 0.004150091734336279, 0.004773741784860959, 0.005275800591030858, 0.005602037879842168, 0.005715206551895624, 0.005602037879842168, 0.005275800591030858, 0.004773741784860959, 0.004150091734336279, 0.003466448000315246, 0.002781889682412439, 0.0021449804511547003, 0.0015890406012215013, 0.0011310319416143256, 0.0007734690974565646,
0.0008548155525392126, 0.0012499836092867847, 0.0017561614601114424, 0.0023705700144569524, 0.003074463574296922, 0.0038310175189698874, 0.004586560692134574, 0.005275800591030858, 0.005830661382773607, 0.0061912093467597126, 0.006316280071950432, 0.0061912093467597126, 0.005830661382773607, 0.005275800591030858, 0.004586560692134574, 0.0038310175189698874, 0.003074463574296922, 0.0023705700144569524, 0.0017561614601114424, 0.0012499836092867847, 0.0008548155525392126,
0.0009076743942415001, 0.0013272782789233823, 0.0018647564199807886, 0.0025171578774949516, 0.003264577784210943, 0.004067914412097752, 0.004870177765856866, 0.005602037879842168, 0.0061912093467597126, 0.006574052351702679, 0.0067068570186131155, 0.006574052351702679, 0.0061912093467597126, 0.005602037879842168, 0.004870177765856866, 0.004067914412097752, 0.003264577784210943, 0.0025171578774949516, 0.0018647564199807886, 0.0013272782789233823, 0.0009076743942415001,
0.0009260106333131518, 0.00135409107874604, 0.0019024269984878957, 0.002568007839679253, 0.0033305266300735804, 0.004150091734336279, 0.004968561882895685, 0.005715206551895624, 0.006316280071950432, 0.0067068570186131155, 0.006842344517756951, 0.0067068570186131155, 0.006316280071950432, 0.005715206551895624, 0.004968561882895685, 0.004150091734336279, 0.0033305266300735804, 0.002568007839679253, 0.0019024269984878957, 0.00135409107874604, 0.0009260106333131518,
0.0009076743942415001, 0.0013272782789233823, 0.0018647564199807886, 0.0025171578774949516, 0.003264577784210943, 0.004067914412097752, 0.004870177765856866, 0.005602037879842168, 0.0061912093467597126, 0.006574052351702679, 0.0067068570186131155, 0.006574052351702679, 0.0061912093467597126, 0.005602037879842168, 0.004870177765856866, 0.004067914412097752, 0.003264577784210943, 0.0025171578774949516, 0.0018647564199807886, 0.0013272782789233823, 0.0009076743942415001,
0.0008548155525392126, 0.0012499836092867847, 0.0017561614601114424, 0.0023705700144569524, 0.003074463574296922, 0.0038310175189698874, 0.004586560692134574, 0.005275800591030858, 0.005830661382773607, 0.0061912093467597126, 0.006316280071950432, 0.0061912093467597126, 0.005830661382773607, 0.005275800591030858, 0.004586560692134574, 0.0038310175189698874, 0.003074463574296922, 0.0023705700144569524, 0.0017561614601114424, 0.0012499836092867847, 0.0008548155525392126,
0.0007734690974565646, 0.0011310319416143256, 0.0015890406012215013, 0.0021449804511547003, 0.002781889682412439, 0.003466448000315246, 0.004150091734336279, 0.004773741784860959, 0.005275800591030858, 0.005602037879842168, 0.005715206551895624, 0.005602037879842168, 0.005275800591030858, 0.004773741784860959, 0.004150091734336279, 0.003466448000315246, 0.002781889682412439, 0.0021449804511547003, 0.0015890406012215013, 0.0011310319416143256, 0.0007734690974565646,
0.0006724217297003478, 0.0009832719329415178, 0.001381445533054985, 0.0018647564199807886, 0.002418458705376228, 0.003013585116655789, 0.003607916426905765, 0.004150091734336279, 0.004586560692134574, 0.004870177765856866, 0.004968561882895685, 0.004870177765856866, 0.004586560692134574, 0.004150091734336279, 0.003607916426905765, 0.003013585116655789, 0.002418458705376228, 0.0018647564199807886, 0.001381445533054985, 0.0009832719329415178, 0.0006724217297003478,
0.0005616538403243442, 0.0008212977553028339, 0.001153880302447998, 0.0015575754891478846, 0.0020200665141290397, 0.0025171578774949516, 0.003013585116655789, 0.003466448000315246, 0.0038310175189698874, 0.004067914412097752, 0.004150091734336279, 0.004067914412097752, 0.0038310175189698874, 0.003466448000315246, 0.003013585116655789, 0.0025171578774949516, 0.0020200665141290397, 0.0015575754891478846, 0.001153880302447998, 0.0008212977553028339, 0.0005616538403243442,
0.0004507377648081042, 0.0006591068873549146, 0.0009260106333131518, 0.0012499836092867847, 0.0016211413507230966, 0.0020200665141290397, 0.002418458705376228, 0.002781889682412439, 0.003074463574296922, 0.003264577784210943, 0.0033305266300735804, 0.003264577784210943, 0.003074463574296922, 0.002781889682412439, 0.002418458705376228, 0.0020200665141290397, 0.0016211413507230966, 0.0012499836092867847, 0.0009260106333131518, 0.0006591068873549146, 0.0004507377648081042,
0.00034754206833684524, 0.0005082054107090616, 0.0007140019672870738, 0.0009638018441690448, 0.0012499836092867847, 0.0015575754891478846, 0.0018647564199807886, 0.0021449804511547003, 0.0023705700144569524, 0.0025171578774949516, 0.002568007839679253, 0.0025171578774949516, 0.0023705700144569524, 0.0021449804511547003, 0.0018647564199807886, 0.0015575754891478846, 0.0012499836092867847, 0.0009638018441690448, 0.0007140019672870738, 0.0005082054107090616, 0.00034754206833684524,
0.000257465496677347, 0.00037648782810231063, 0.0005289456669688587, 0.0007140019672870738, 0.0009260106333131518, 0.001153880302447998, 0.001381445533054985, 0.0015890406012215013, 0.0017561614601114424, 0.0018647564199807886, 0.0019024269984878957, 0.0018647564199807886, 0.0017561614601114424, 0.0015890406012215013, 0.001381445533054985, 0.001153880302447998, 0.0009260106333131518, 0.0007140019672870738, 0.0005289456669688587, 0.00037648782810231063, 0.000257465496677347,
0.00018325629967027186, 0.000267972862924577, 0.00037648782810231063, 0.0005082054107090616, 0.0006591068873549146, 0.0008212977553028339, 0.0009832719329415178, 0.0011310319416143256, 0.0012499836092867847, 0.0013272782789233823, 0.00135409107874604, 0.0013272782789233823, 0.0012499836092867847, 0.0011310319416143256, 0.0009832719329415178, 0.0008212977553028339, 0.0006591068873549146, 0.0005082054107090616, 0.00037648782810231063, 0.000267972862924577, 0.00018325629967027186,
0.0001253219113395547, 0.00018325629967027186, 0.000257465496677347, 0.00034754206833684524, 0.0004507377648081042, 0.0005616538403243442, 0.0006724217297003478, 0.0007734690974565646, 0.0008548155525392126, 0.0009076743942415001, 0.0009260106333131518, 0.0009076743942415001, 0.0008548155525392126, 0.0007734690974565646, 0.0006724217297003478, 0.0005616538403243442, 0.0004507377648081042, 0.00034754206833684524, 0.000257465496677347, 0.00018325629967027186, 0.0001253219113395547,
}};
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 color = float4(0,0,0,0);
float w = 1.0f/InputSize.x;
float h = 1.0f/InputSize.y;
int width = 21;
int center = width/2;
for(int x = -center; x <= center; x++)
for(int y = -center; y <= center; y++)
{
//float2 p = float2((x - center) * w, (y - center) * h);
//float4 c = tex2D(input, saturate(uv.xy + p));
float4 c = tex2D(input, saturate(uv.xy + float2(x * w, y * h)));
int offset = (y + center) * width + (x + center);
float g = kernel[offset];
color += c * g;
}
return color;
}