it's how "real" bloom works

I tried out the new pp-feature with view of the latest A7-beta, so not everyone can really use that code
Code:
BMAP* FirstScreen = "#1024x768x32";
var blurStrongness = 40;
var blurRadius = 0.3;
var blurAlpha = 40;
var darken = 90;
var greyOut = 90;
MATERIAL* mtlBlackout =
{
effect = "
Texture TargetMap;
sampler2D smpSource = sampler_state { texture = <TargetMap>; };
float4 vecViewPort; // contains viewport pixel size in zw components
float4 vecSkill1;
float4 BlackoutPS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw);
if((Color.r+Color.g+Color.b)/3<vecSkill1.x)
{
Color.rgb = 0;
}
return Color;
}
technique emboss { pass one { PixelShader = compile ps_2_0 BlackoutPS(); } }
technique fallback { pass one { } }";
}
MATERIAL* mtlBlurH =
{
effect = "
float4 vecViewPort;
float4 vecSkill1;
static int blurRadius = 5;//number of px
Texture TargetMap;
sampler2D smpSource = sampler_state{texture=<TargetMap>;};
float4 BlurHPS( float2 Tex: TEXCOORD0):COLOR0
{
float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw);
float2 tempTex;
tempTex.y = Tex.y;
for(int i=-blurRadius;i<=blurRadius;i++)
{
tempTex.x = Tex.x+i*vecSkill1;
Color += tex2D(smpSource,tempTex.xy-vecViewPort.zw);
}
return Color/(blurRadius*2+1);
}
technique Blackout { pass one { PixelShader = compile ps_2_0 BlurHPS();}}
technique fallback { pass one { } }";
}
MATERIAL* mtlBlurV =
{
effect = "
float4 vecViewPort;
float4 vecSkill1;
static int blurRadius = 5;//number of px
Texture TargetMap;
sampler2D smpSource = sampler_state{texture=<TargetMap>;};
float4 BlurVPS( float2 Tex: TEXCOORD0):COLOR0
{
float4 Color = tex2D(smpSource,Tex.xy-vecViewPort.zw);
float2 tempTex;
tempTex.x = Tex.x;
for(int i=-blurRadius;i<=blurRadius;i++)
{
tempTex.y = Tex.y+i*vecSkill1.x;
Color += tex2D(smpSource,tempTex.xy-vecViewPort.zw);
}
return Color/(blurRadius*2+1);
}
technique Blackout { pass one { PixelShader = compile ps_2_0 BlurVPS();}}
technique fallback { pass one { } }";
}
MATERIAL* mtlAdd =
{
skin1 = FirstScreen;
effect = "
float4 vecViewPort;
float4 vecSkill1;
Texture TargetMap;
Texture mtlSkin1;
sampler2D smpSource = sampler_state{texture=<TargetMap>;};
sampler2D firstScreen = sampler_state{texture=<mtlSkin1>;};
float4 AddPS( float2 Tex: TEXCOORD0):COLOR0
{
float4 Color = tex2D(firstScreen,Tex);
Color += vecSkill1.x*tex2D(smpSource,Tex);
return lerp(Color,(Color.r+Color.g+Color.b)/3,vecSkill1.z)*vecSkill1.y;
}
technique Blackout { pass one { PixelShader = compile ps_2_0 AddPS();}}
technique fallback { pass one { } }";
}
VIEW* viewBlackout = { material = mtlBlackout; flags = PROCESS_TARGET; }
VIEW* viewBlurH = { material = mtlBlurH; flags=PROCESS_TARGET;}
VIEW* viewBlurV = { material = mtlBlurV; flags=PROCESS_TARGET;}
VIEW* viewAdd = { material = mtlAdd; flags=PROCESS_TARGET;}
void controlBloomSettings()
{
camera.bmap = FirstScreen;
camera.stage = viewBlackout;
viewBlackout.stage = viewBlurH;
viewBlurH.stage = viewBlurV;
viewBlurV.stage = viewAdd;
while(1)
{
mtlBlackout.skill1 = floatv((100-blurStrongness)/100);
mtlBlurH.skill1 = floatv(blurRadius/100);
mtlBlurV.skill1 = floatv(blurRadius/100);
mtlAdd.skill1 = floatv(blurAlpha/100);
mtlAdd.skill2 = floatv(darken/100);
mtlAdd.skill3 = floatv((100-greyOut)/100);
wait(1);
}
}
PS: I use vars, because only then the panel elements show right results...