0
\$\begingroup\$

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:

blur

Is there a way to avoid this effect?

\$\endgroup\$
2
  • 4
    \$\begingroup\$ 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.) \$\endgroup\$ Commented Jun 9, 2013 at 18:05
  • 2
    \$\begingroup\$ A good blur is to use 1/width and 1/height for X, Y respectively. \$\endgroup\$ Commented Jun 10, 2013 at 4:08

1 Answer 1

3
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .