   Im doing a blur box effect in HSL, how do I get the neighborg pixels?
  I'm doing a blur Box effect but I don't khow do I get the neighbor pixels, or is there a way to distort the image before the pixel shader? The code in C# its likenamespace Graphics{    /// <summary>    /// Class for doing a box blur    /// </summary>    class BoxBlur    {   #region Static Functions   /// <summary>   /// Does a box blur on the array passed in   /// </summary>   /// <param name="Values">Array of values to blur</param>   /// <param name="Width">Width of the array</param>   /// <param name="Height">Height of the array</param>   /// <param name="HRadius">Width of the box</param>   /// <param name="VRadius">Height of the box</param>   /// <returns>returns a blurred version of the input array</returns>   public static float[,] Blur(float[,] Values, int Width, int Height, int BoxWidth, int BoxHeight)   {  float[,] FinalValues = new float[Width, Height];  for (int y = 0; y < Height; ++y)  { for (int x = (BoxWidth / 2); x < Width; ++x) {float Sum = 0.0f;for (int x2 = -(BoxWidth / 2); x2 < (BoxWidth / 2); ++x2){    for (int y2 = -(BoxHeight / 2); y2 < (BoxHeight / 2); ++y2)    {   if (x + x2 >= 0 && x + x2 < Width && y + y2 >= 0 && y + y2 < Height)   {  Sum += Values[x + x2, y + y2];   }    }}FinalValues[(x + BoxWidth / 2) % Width, y] = Sum / (float)(BoxWidth + BoxHeight); }  }  return FinalValues;   }   #endregion    }}thanks in advance,Alex   
  I don't do HLSL so you can take my advice with a grain of salt, but I'm fairly certain you will need to do a second round of post-processing to achieve this. Need to first render your un-blurred scene to a texture, then render this texture to a fullscreen screen-aligned quad. When rendering this quad you can sample as many texture pixels as you need to achieve blur.When you are actually rendering the scene you cannot access neighboring pixels because these are all written in parallel, so you have no way to know which pixels have been burned to the FB yet. Plus every pixel would require that every neighboring pixel be complete, which is impossible.   ;Quote:Original post by karwostsI don't do HLSL so you can take my advice with a grain of salt, but I'm fairly certain you will need to do a second round of post-processing to achieve this. Need to first render your un-blurred scene to a texture, then render this texture to a fullscreen screen-aligned quad. When rendering this quad you can sample as many texture pixels as you need to achieve blur.When you are actually rendering the scene you cannot access neighboring pixels because these are all written in parallel, so you have no way to know which pixels have been burned to the FB yet. Plus every pixel would require that every neighboring pixel be complete, which is impossible.Ive never done a blur effect but Im pretty sure that karwosts is right...;  I found a code from ATI I get this erroralso what means TEXCOORD0 TEXCOORD1 etc..?They are doing a separable gaussian. I have an error X3000: invalid target or usage string atfloat2 outerTaps[NUM_OUTER_TAPS];float4 hlsl_gaussian (float2 tapZero : TEXCOORD0,float2 tap12 : TEXCOORD1,float2 tapMinus12 : TEXCOORD2,float2 tap34 : TEXCOORD3,float2 tapMinus34 : TEXCOORD4,float2 tap56 : TEXCOORD5,float2 tapMinus56 : TEXCOORD6 ) : COLOR{   float4 accum, Color[NUM_INNER_TAPS];   Color[0] = tex2D(nearestImageSampler, tapZero); // sample 0   Color[1] = tex2D(linearImageSampler, tap12); // samples 1, 2   Color[2] = tex2D(linearImageSampler, tapMinus12); // samples -1, -2   Color[3] = tex2D(linearImageSampler, tap34); // samples 3, 4   Color[4] = tex2D(linearImageSampler, tapMinus34); // samples -3, -4   Color[5] = tex2D(linearImageSampler, tap56); // samples 5, 6   Color[6] = tex2D(linearImageSampler, tapMinus56); // samples -5, -6   accum = Color[0] * gTexelWeight[0]; // Weighted sum of samples   accum += Color[1] * gTexelWeight[1];   accum += Color[2] * gTexelWeight[1];   accum += Color[3] * gTexelWeight[2];   accum += Color[4] * gTexelWeight[2];   accum += Color[5] * gTexelWeight[3];   accum += Color[6] * gTexelWeight[3];   float2 outerTaps[NUM_OUTER_TAPS];   outerTaps[0] = tapZero * gTexelOffset[0]; // coord for samp 7, 8   outerTaps[1] = tapZero * -gTexelOffset[0]; // coord for samp -7, -8   outerTaps[2] = tapZero * gTexelOffset[1]; // coord for samp 9, 10   outerTaps[3] = tapZero * -gTexelOffset[1]; // coord for samp -9, -10   outerTaps[4] = tapZero * gTexelOffset[2]; // coord for samp 11, 12   outerTaps[5] = tapZero * -gTexelOffset[2]; // coord for samp -11,-12   // Sample the outer taps   for (int i=0; i<NUM_OUTER_TAPS; i++) {   Color = tex2D (linearImageSampler, outerTaps);   }   accum += Color[0] * gTexelWeight[4]; // Accumulate outer taps   accum += Color[1] * gTexelWeight[4];   accum += Color[2] * gTexelWeight[5];   accum += Color[3] * gTexelWeight[5];   accum += Color[4] * gTexelWeight[6];   accum += Color[5] * gTexelWeight[6];return accum;}thanks in advance,Alex;  How is the NUM_OUTER_TAPS defined? The code compiles fine in PS2.0 and PS3.0 if I introduce the following globals before the function:#define NUM_INNER_TAPS 8#define NUM_OUTER_TAPS 8float gTexelWeight[7];float gTexelOffset[3];sampler nearestImageSampler;sampler linearImageSampler;TEXCOORDn semantics map to texture coordinate registers. The number is the usage index of the element.   