• Advertisement
Sign in to follow this  

problem with Gaussian blur

This topic is 2425 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys
I was having a bit of trouble with my gaussian blur implementation. I am doing the weights and the sampling correctly but i still am getting zero output.

here is the FX file

//Weights

static const float Sigma = 1.0f;
static const float g = 1.0f / sqrt(2.0f*3.141592654*Sigma);

float BlurWeights[]
= {g * exp(-49/(2.0f*Sigma*Sigma)) , g * exp(-36/(2.0f*Sigma*Sigma)) , g * exp(-25/(2.0f*Sigma*Sigma)) , g * exp(-16/(2.0f*Sigma*Sigma)),
g * exp(-9/(2.0f*Sigma*Sigma)) , g * exp(-4/(2.0f*Sigma*Sigma)) , g * exp(-1/(2.0f*Sigma*Sigma)) , g ,
g * exp(-1/(2.0f*Sigma*Sigma)) , g * exp(-4/(2.0f*Sigma*Sigma)) , g * exp(-9/(2.0f*Sigma*Sigma)) , g * exp(-16/(2.0f*Sigma*Sigma)),
g * exp(-25/(2.0f*Sigma*Sigma)) , g * exp(-36/(2.0f*Sigma*Sigma)) , g * exp(-49/(2.0f*Sigma*Sigma)) };


//Blur on The X-Axis
//========================================

float4 BlurX_PShader(float2 TexC : TEXCOORD0):COLOR
{
float4 TexColor = tex2D(BP_sTex, TexC);

for(int i = 0; i < 15; i++)
{
TexColor += tex2D(BP_sTex, TexC + ((i-7)/SourceDimensions.x) ) * BlurWeights;
}

return TexColor/15.0f;
}

//Blur on The Y-Axis
//========================================

float4 BlurY_PShader(float2 TexC : TEXCOORD0):COLOR
{
float4 TexColor = tex2D(Blur_sTex, TexC);

for(int i = 0; i < 15; i++)
{
TexColor += tex2D(Blur_sTex, TexC + ( (i-7)/SourceDimensions.y) ) * BlurWeights;
}

return TexColor/15.0f;
}


Here are my steps:
- BeginScene() with the Blur texture as a render target
- Apply the BlurX Technique
- EndScene()

- BeginScene() with the Blur texture as a render target
- Take the Blur texture and apply the BlurY technique on it.
- EndScene()

Thanks for the help

Share this post


Link to post
Share on other sites
Advertisement
i did what you said and i am still getting no output whatsoever.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement