Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 tried to implement the blur shader shown here.

Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply this on a 3D plane:

struct v2f {
    float4 pos : SV_POSITION;
    float4 screenPos : TEXCOORD3;
    float3 uv;

v2f vert(appdata_full v)
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    o.screenPos = ComputeScreenPos(o.pos); 
    o.uv = UNITY_PROJ_COORD(o.screenPos);
    return o;

// In the frag part there is the shader blur computation but based on XYZ, with Z = 0

Then I apply the blur and this leads to this when I zoom in:


Is there a way to avoid this effect?

share|improve this question
The duplication effect is due to the samples in the blur kernel being spaced too far apart. You need to either decrease the radius of the blur, or add more samples so that you can blur such a large radius smoothly. (Or apply multiple blur passes, or downsample the image before blurring it.) – Nathan Reed Jun 9 '13 at 18:05
Thanks for your answer ! That's what I was thinking. – MaT Jun 9 '13 at 18:28
A good blur is to use 1/width and 1/height for X, Y respectively. – Sean Middleditch Jun 10 '13 at 4:08
up vote 3 down vote accepted

I concur with Nathan Reed's assessment that the issue is probably caused by spacing your blur kernel too widely.

Use additional rendering passes, downsample the image, decrease your blur radius, or some combination thereof.

share|improve this answer

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.