Hi,
is it possible to combine shaders? can someone do this for me?

I have a Bloom shader and a blur shader but i cant seem to get them to work together. If anyone has a better blur shader please post.

Blur shader (pp_gaussian.fx)
Quote:

Texture TargetMap;
sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear; };

float4 vecViewPort;

float4 postprocessing_gaussian(float2 Tex : TEXCOORD0) : COLOR0
{
float4 sampleM = tex2D(g_samSrcColor, Tex.xy);
float4 sampleB0 = tex2D( g_samSrcColor, Tex.xy - vecViewPort.zw );
float4 sampleF0 = tex2D( g_samSrcColor, Tex.xy + vecViewPort.zw );
float4 sampleB1 = tex2D( g_samSrcColor, Tex.xy - vecViewPort.zw*2. );
float4 sampleF1 = tex2D( g_samSrcColor, Tex.xy + vecViewPort.zw*2. );
//float4 sampleB2 = tex2D( g_samSrcColor, Tex.xy - vecViewPort.zw*3. );
//float4 sampleF2 = tex2D( g_samSrcColor, Tex.xy + vecViewPort.zw*3. );

return 0.1752 * sampleM + 0.1658 * (sampleB0 + sampleF0) + 0.1403 * (sampleB1 + sampleF1);// + 0.1063 * (sampleB2 + sampleF2);
}

technique PostProcess
{
pass p1
{
AlphaBlendEnable = false;
VertexShader = null;
PixelShader = compile ps_2_0 postprocessing_gaussian();
}
}



Bloom shader (bloom.fx)

Quote:

float4 vecSkill1;

texture entSkin1;

sampler postTex = sampler_state
{
texture = (entSkin1);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
;




float Luminance = 0.08f;
static const float fMiddleGray = 0.18f;
static const float fWhiteCutoff = 0.8f;

#define NUM 13 //13

float2 PixelOffsets[NUM] =
{
{ -0.006, -0.006 },
{ -0.005, -0.005 },
{ -0.004, -0.004 },
{ -0.003, -0.003 },
{ -0.002, -0.002 },
{ -0.001, -0.001 },
{ 0.000, 0.000 },
{ 0.001, 0.001 },
{ 0.002, 0.002 },
{ 0.003, 0.003 },
{ 0.004, 0.004 },
{ 0.005, 0.005 },
{ 0.006, 0.006 },
};

static const float BlurWeights[NUM] =
{
0.002216,
0.008764,
0.026995,
0.064759,
0.120985,
0.176033,
0.199471,
0.176033,
0.120985,
0.064759,
0.026995,
0.008764,
0.002216,
};





float4 Bloom_PS_3_0(float2 texcoord0 : TEXCOORD0) : COLOR
{
float3 pixel;
float3 Color = 0;

for(int i = 0; i < NUM; i++)
{
pixel = tex2D(postTex,texcoord0 + PixelOffsets[i] * 5.0f)+vecSkill1[1];

pixel *= fMiddleGray / (Luminance + 0.001f);
pixel *= (1.0f + (pixel / (fWhiteCutoff * fWhiteCutoff)));
pixel -= 5.0f;

pixel = max(pixel,0.0f);
pixel /= (10.0f + pixel);

Color += pixel * BlurWeights[i];
}

Color *= vecSkill1[0];

return float4(Color,1.0) + tex2D(postTex,texcoord0);
}

float4 Bloom_PS_2_0(float2 texcoord0 : TEXCOORD0) : COLOR
{
float3 pixel;
float3 Color = 0;

for(int i = 4; i < 9; i++)
{
pixel = tex2D(postTex,texcoord0 + PixelOffsets[i] * 5.0f)+vecSkill1[1];

pixel *= fMiddleGray / (Luminance + 0.001f);
pixel *= (1.0f + (pixel / (fWhiteCutoff * fWhiteCutoff)));
pixel -= 5.0f;

pixel = max(pixel,0.0f);
pixel /= (10.0f + pixel);

Color += pixel * BlurWeights[i];
}

Color *= vecSkill1[0];

return float4(Color,1.0) + tex2D(postTex,texcoord0);
}


/*
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_3_0 Bloom_PS_3_0();
}
}
*/


technique tech_01
{
pass pass_00
{

VertexShader = null;
PixelShader = compile ps_2_0 Bloom_PS_2_0();

}
}
/*
technique tech_02
{
pass pass_00
{
Texture[0] = <entSkin1>;
}
}
*/




Thank you!