Jump to content
  • Advertisement
Sign in to follow this  
Xmon

Multiple bluring

This topic is 4497 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

Part of my shader blurs a texture to another texture render target. However the blur is not enough. How do I set up the fx and cpp file to blur a second pass. My code looks like this:
struct VS_GLOWOUTPUT
{
	float4 Position	: POSITION;
	float2 ScreenPos0 : TEXCOORD0;
	float2 ScreenPos1 : TEXCOORD1;
	float2 ScreenPos2 : TEXCOORD2;
	float2 ScreenPos3 : TEXCOORD3;
	float2 ScreenPos4 : TEXCOORD4;
	float2 ScreenPos5 : TEXCOORD5;
	float2 ScreenPos6 : TEXCOORD6;
	float2 ScreenPos7 : TEXCOORD7;
};

VS_GLOWOUTPUT RenderGlowVS(float4 vPos: POSITION, float2 vTexCoord0: TEXCOORD0)
{
	VS_GLOWOUTPUT Output;
	Output.Position=vPos;
	Output.ScreenPos0=vTexCoord0+gCoordOffset[0];
	Output.ScreenPos1=vTexCoord0+gCoordOffset[1];
	Output.ScreenPos2=vTexCoord0+gCoordOffset[2];
	Output.ScreenPos3=vTexCoord0+gCoordOffset[3];
	Output.ScreenPos4=vTexCoord0+gCoordOffset[4];
	Output.ScreenPos5=vTexCoord0+gCoordOffset[5];
	Output.ScreenPos6=vTexCoord0+gCoordOffset[6];
	Output.ScreenPos7=vTexCoord0+gCoordOffset[7];
	return Output;
}

struct PS_GLOWOUTPUT
{
	float4 RGBColor : COLOR0;
};

PS_GLOWOUTPUT RenderGlowPS(VS_GLOWOUTPUT In)
{
	PS_GLOWOUTPUT Out;
	float4 temp0 = tex2D(GlowTextureSampler,In.ScreenPos0);
	float4 temp1 = tex2D(GlowTextureSampler,In.ScreenPos1);
	float4 temp2 = tex2D(GlowTextureSampler,In.ScreenPos2);
	float4 temp3 = tex2D(GlowTextureSampler,In.ScreenPos3);
	float4 temp4 = tex2D(GlowTextureSampler,In.ScreenPos4);
	float4 temp5 = tex2D(GlowTextureSampler,In.ScreenPos5);
	float4 temp6 = tex2D(GlowTextureSampler,In.ScreenPos6);
	float4 temp7 = tex2D(GlowTextureSampler,In.ScreenPos7);
	
	Out.RGBColor.rgb =	temp0.rgb * temp0.aaa * gWeight[0].rrr +
						temp1.rgb * temp1.aaa * gWeight[1].rrr +
						temp2.rgb * temp2.aaa * gWeight[2].rrr +
						temp3.rgb * temp3.aaa * gWeight[3].rrr +
						temp4.rgb * temp4.aaa * gWeight[4].rrr +
						temp5.rgb * temp5.aaa * gWeight[5].rrr +
						temp6.rgb * temp6.aaa * gWeight[6].rrr +
						temp7.rgb * temp7.aaa * gWeight[7].rrr;
	Out.RGBColor.a=1.0f;
	return Out;
};

And, another question, can you set a global variable inside a technique? Thank you for your time:)

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!