Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have simple blur shader which I calculate offsets in:

Piece of vertex shader:

output.texCoord1 = input.tex + float2( texelSize * -4.0f, 0.0f );
output.texCoord12 = input.tex + float2( texelSize * -3.0f, 0.0f );
output.texCoord13 = input.tex + float2( texelSize * -2.0f, 0.0f );
output.texCoord14 = input.tex + float2( -texelSize, 0.0f );
output.texCoord15 = input.tex + float2( 0.0f, 0.0f );
output.texCoord16 = input.tex + float2( texelSize, 0.0f );
output.texCoord17 = input.tex + float2( texelSize *  2.0f, 0.0f );
output.texCoord18 = input.tex + float2( texelSize *  3.0f, 0.0f );
output.texCoord19 = input.tex + float2( texelSize *  4.0f, 0.0f );

However with this manner I have artifacts on the sides of the screen:


I know that it occurs because when the offset goes out from the right it takes pixels from the left appropriately.

So my question is: how is the "standard" way to deal with this? I was trying to saturate() all of the values assigned to output.texCoordX, it removes the artifacts in 95%, but it makes my blur much weaker and with strange sharper edges ("roll my log and I will roll yours"?).

share|improve this question
up vote 6 down vote accepted

Wouldn't setting your texture's edge mode to clamp (instead of repeat) solve this issue?

share|improve this answer
oh my god that was so easy, I just have forgotten that sampler field, thank you – tobi Jan 21 '13 at 10:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.