Pixelization effect, turn off AA?

Hello,

Is there any way I could remove this pixel smoothing (semitransparent pixels on edges)?

Code I am using:

public class ScreenPixelization : MonoBehaviour
{
    [Range(1, 25)] public int resolution = 8;


    void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        RenderTexture lowRez;

        int w = source.width / resolution;
        int h = source.height / resolution;

        lowRez = RenderTexture.GetTemporary(w, h);
        lowRez.filterMode = FilterMode.Point;

        Graphics.Blit(source, lowRez);
        Graphics.Blit(lowRez, destination);
    }
}

Thanks!

You have MSAA or FXAA or Post Effect AA enabled.

A render texture (not a temporary one) is able to exclude MSAA if that’s the problem. Otherwise don’t render it with AA to begin with.

My quality and camera settings:
3149249--239317--upload_2017-7-18_15-5-32.png3149249--239318--upload_2017-7-18_15-5-59.png

As you can see I have AA and MSAA disabled. Is there something Ive missed?

Anyone? I found some questions about same problem and they also not answered. This should not be very hard to solve

bump?

The issue you’re seeing is due to bilinear sampling of the original render texture, in part likely caused by the initial screen resolution not being a multiple of 8, though correcting for just that will just mean all of the samples will be “blurry” add they’ll be bilinearly sampled from the exact center of 4 pixels.

Try setting the source texture to point filtered.

I tried setting my screen to 512x256
3165976--241055--upload_2017-7-31_12-42-45.png

Also I update the code and set source texture to point filtering

    void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        RenderTexture lowRez;
        Debug.Log("SOURCE: " + source.width + " " + source.height);
        var w = source.width / resolution;
        var h = source.height / resolution;
        Debug.Log("TARGET: " + w + " " + h);
    
        source.filterMode = FilterMode.Point;     
        lowRez = RenderTexture.GetTemporary(w, h);
        lowRez.filterMode = FilterMode.Point;
       
        Graphics.Blit(source, lowRez);
        Graphics.Blit(lowRez, destination);
        RenderTexture.ReleaseTemporary(lowRez);
    }

Still I have this AA :frowning:

Using that code exactly as is with either deferred or forward with MSAA disabled works perfectly for me. I’m using Unity 5.6.1 to test, and I disabled MSAA directly on the camera (Allow MSAA).

Could it possibly be driver AA from driver control panel or such?

1 Like

All driver settings were application controlled. I tried to set them off but AA still appears.
The only way I was able to get sharp pixels on edges was rendering to already created low res texture using camera. And then drawing it using OnGUI method. I dont like this solution because of some problems with different resolutions and unity shows annoying popup if there is no camera that rendering to display.
I tried shader solutions but they also produce AA.