Search Unity

RenderTexture and FXAA/TAA (anti-aliasing) generating unwanted alpha changes causing artifacts

Discussion in 'Image Effects' started by howong, Nov 16, 2017.

  1. howong

    howong

    Joined:
    Oct 9, 2017
    Posts:
    6
    Hello gurus. I much appreciate your help. Thanks!

    I tried FXAA (anti-aliasing) from 3 different assets:
    Post Processing Stack https://www.assetstore.unity3d.com/en/#!/content/83912
    Legacy Cinematic Image Effects https://www.assetstore.unity3d.com/en/#!/content/51515
    XAA Fast Approximate Anti-Aliasing https://www.assetstore.unity3d.com/en/#!/content/3590.
    I render onto a RenderTexture (assigned to the camera via script) and, subsequently, the texture is read into a Texture2D and then encoded as a PNG file.
    The result has many artifacts caused by the alpha values being changed for the pixels where the object in the image should be solid/opaque. The alpha changes make spots on the object that are translucent or totally transparent. The RenderTexture has depth = 24, format = ARGB32, and readWrite = Linear (this color space was recommended by Unity for post processing). The Texture2D also has format = ARGB32. The camera's Rendering Path is Deferred (as recommended by Unity for post processing).
    A similar but worse issue happens with TAA (anti-aliasing) - the PNG image is blank (alpha values are all zero).

    There doesn't seem to be any artifacts in the game window itself prior to exporting the image.

    The issue seems to "go away" if I set the format of the Texture2D to RGB24, but that is just because there's no alpha in the final image, but I definitely need alpha because I am generating sprite characters, etc.

    I attached a sample PNG image for FXAA.
    (Model credit: TiZeta https://www.blendswap.com/blends/view/66413, license CC-BY https://creativecommons.org/licenses/by/3.0)

    Any help is much appreciated. Thanks!

    SpriteSheet_2017-11-16_14-50-53.png
     
    Last edited: Nov 16, 2017