# Box Blur dark border issue...

3 replies to this topic

### #1David Gallagher

New Member

• Members
• 68 posts

Posted 12 July 2012 - 04:19 AM

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...

### #2Reedbeta

DevMaster Staff

• 5308 posts
• LocationSanta Clara, CA

Posted 12 July 2012 - 06:31 AM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #3David Gallagher

New Member

• Members
• 68 posts

Posted 12 July 2012 - 07:14 AM

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 .

### #4David Gallagher

New Member

• Members
• 68 posts

Posted 16 July 2012 - 05:27 AM

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));
//-------------------------------------------------------------
}


#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users