Original Post
I've wrote a Bloom shader in glsl and although it works, technically at least, it looks pretty awful and nothing like Ghost Recon or any other hdr game. Here's the shader, tex0 = the viewport copied to a texture. I then use this shader on a screen sized quad over the viewport using material replace not blend/add. As you can see I take a 4x4 sample of each pixel, then scale it into a -0.3 to 0.7 * 32 value, then soften the final sample by deviding it by 256, then I combined this with a 2x amplification of the source viewport with a 1.2 amplification of the blursample vector. Is there a better way? Should I look into multi-pass techniques, and if so are there any tutorials glsl examples you can point me in the direction of please? How did you handle bloom personally? Taking into account I'm using a pixel shader model 2 card that has no hdr floating point texture support.
uniform sampler2D tex0;
void main(void)
{
vec4 blurSample = 0.0;
vec4 tmpPix;
vec4 offPix;
for(int tx =-2;tx<3;tx++)
{
for(int ty =-2;ty<3;ty++)
{
vec2 uv = gl_TexCoord[0].st;
uv.x = uv.x + tx*0.01;
uv.y = uv.y + ty*0.01;
tmpPix = texture2D(tex0,uv);
offPix = -0.3+tmpPix;
offPix = offPix *32;
blurSample = blurSample + offPix;
}
}
blurSample = blurSample / 256;
gl_FragColor = texture2D(tex0,gl_TexCoord[0].st)*2+blurSample*1.2;
}





