Andres Sevilla
Andres Sevilla

Reputation: 1

Blur shader for sprite creating chunks on corners of sprite

I was trying t implement this shader

  fixed4 frag (v2f i) : SV_Target
            {
                // Sample the texture
                fixed4 col = tex2D(_MainTex, i.uv);

                // Only blur the interior of the sprite, keep the edges sharp
                
                 fixed4 blurredCol = blur(_MainTex, i.uv, _BlurAmount);
                 col.rgb = blurredCol.rgb; // Apply blurred color
                

                return col;
            }

Where I simply blur, the texture if alpha is different from cero. However I´m getting a blocky texture from what used to be a pretty high poky sprite.

The blur works fine on the texture, the problem is on the corners i think.

I added this flag

if (col.a > 0.0) // Preserve sharp edges where alpha > 0
                {
                    fixed4 blurredCol = blur(_MainTex, i.uv, _BlurAmount);
                    col.rgb = blurredCol.rgb; // Apply blurred color
                }
                

but still getting the chunky corners.

Upvotes: 0

Views: 32

Answers (0)

Related Questions