0
102 Jul 12, 2012 at 04:19

Hi, I’ve just tried implementing the box blur compute shader example and have found that the blur produces a dark border around the edges of the viewport.
the border increases with the size of the blur. Does anyone know how to remove this or is there something simple I have overlooked. thanks for any advice on this.
(I’m using dx11)

pic showing the issue…

#### 3 Replies

0
167 Jul 12, 2012 at 06:31

The filter kernel is going off the edge of the image. I’m guessing you’re using the Load method in the shader; if so, you’ll have to implement texel clamping yourself. It doesn’t give you any built-in support for that, just returns black if you go off the edge.

If you’re using the Sample method, on the other hand, you just need to set a sampler state that has the proper addressing mode, probably CLAMP.

0
102 Jul 12, 2012 at 07:14

ah that makes sense, thanks Reedbeta, yes I’m using the load method and that would explain things, man there is always a gotcha waiting to jump out of the woodwork :).

0
102 Jul 16, 2012 at 05:27

Just thought i’d post this for anyone using Load method in hlsl and need to clamp the texture for things like box blur…

int2 ClampUV(uint x,uint y)
{
//-------------------------------------------------------------
return clamp(int2(x,y),int2(0,0),int2(imageW-1,imageH-1));
//-------------------------------------------------------------
}