
This, here, is some cheap, horrible bloom as a full-screen shader. And by "cheap," I mean, "you get what you pay for." Which isn't very much, these days.
The top image is a scene without the bloom. The middle image is a scene with the bloom described below. The bottom image is with the
ds division removed.
Code:
// Bloom test:
material mat_bloom_2 {
effect = "
sampler2D g_samSrcColor;
float ds;
float4 Color;
float4 MyShader( float2 Tex : TEXCOORD0 ) : COLOR0 {
Color = tex2D( g_samSrcColor, Tex.xy);
// Go four pixels out and blend them to this one:
for(ds=1; ds<4; ds++) {
Color += pow( tex2D( g_samSrcColor, float2(Tex.x-ds*0.002, Tex.y)), 3.0f)/ds;
Color += pow( tex2D( g_samSrcColor, float2(Tex.x+ds*0.002, Tex.y)), 3.0f)/ds;
Color += pow( tex2D( g_samSrcColor, float2(Tex.x, Tex.y-ds*0.002)), 3.0f)/ds;
Color += pow( tex2D( g_samSrcColor, float2(Tex.x, Tex.y+ds*0.002)), 3.0f)/ds;
}
return Color;
}
// Just one pass:
technique PostProcess {
pass p1 {
VertexShader = null;
PixelShader = compile ps_2_0 MyShader();
}
}
";
}
I apply this to a screen-aligned quad (requires Pro for render-to-texture). As you might be able to tell, I'm just goofing around. I don't actually know anytihng about shaders.
Yet! ;
)