//
// Blur vertically
// Input: HDR image, already blurred horizontally
// Output: vertically blurred
//
// Path: HDR-> FBO1 -> FBO2, mix HDR+FBO2 -> screen
// FBO1 = horizontally blurred image, FBO2=also vertically blurred
//
// RvG, 10-3-09
//

struct VertOut
{
	float4 pos : POSITION;
	float4 col : COLOR0;
	float2 tc0 : TEXCOORD0;
};

struct FragOut
{
	float4 col : COLOR;
};

FragOut main(
  VertOut vin,
	uniform sampler2D tex0 : TEXUNIT0
)
{
  FragOut fout;
  float2 BlurOffset=float2(0, 1.0/768.0);
  float PixelWeight[8] = { 0.2537, 0.2185, 0.0821, 0.0461, 0.0262, 0.0162, 0.0102, 0.0052 };

  float4 color=0; //tex2D(tex0,vin.tc0);

  // Sample pixels on either side
  for(int i=0;i<8;++i)
  {
    color+=tex2D(tex0,vin.tc0+(BlurOffset*i))*PixelWeight[i];
    color+=tex2D(tex0,vin.tc0-(BlurOffset*i))*PixelWeight[i];
  }

  fout.col=color; //*2.0;

  return fout;
} 
