Page 1 of 1

[Unity] AntialiasingAsPost messes up UI

Posted: 03 Jun 2014, 16:16
by Basp
When I use the AntialiasingAsPostEffect script from the Unity Pro Standard Assets on my main camera (to which my Noesis GUIPanel is also attached), my scene renders with antialiasing but the UI on the GUIPanel looks incredibly noisy, and is upside-down. If I disable the AntialiasingAsPostEffect script, the UI looks fine.

Is this a known problem? And more importantly, is there a workaround for this, where my scene is antialiased but the UI on the GUIPanels is left alone?

Re: [Unity] AntialiasingAsPost messes up UI

Posted: 03 Jun 2014, 20:05
by wckdspn
Yeah, because of the render order in Unity, posteffects end up messing with the UI,

You can make a couple of tweaks to have Noesis render later

In NoesisGUIPanel.cs, change the OnPostRender() function to:
    void OnPostRender()
    {
        if (_uiRenderer != null)
        {
            StartCoroutine(EndOfFrameRender());
        }
    }

    IEnumerator EndOfFrameRender()
    {
        yield return new WaitForEndOfFrame();
        _uiRenderer.PostRender();
    }
And then in comment out or remove this block (I recommend the former, to make it easier to merge with new versions)
if (camera != null &&
     camera.actualRenderingPath == UnityEngine.RenderingPath.DeferredLighting)
{
     flags |= RendererFlags.FlipY;
}

Re: [Unity] AntialiasingAsPost messes up UI

Posted: 04 Jun 2014, 10:42
by Basp
Thank you very much, that worked like a charm!

Re: [Unity] AntialiasingAsPost messes up UI

Posted: 23 Aug 2014, 06:41
by ai_enabled
Hello!
You can improve this script by making OnPostRender() method coroutine itself:
    IEnumerator OnPostRender()
    {
        yield return new WaitForEndOfFrame();
        if (_uiRenderer != null)
        {            
            _uiRenderer.PostRender();
        }
    }
API reference: MonoBehaviour.OnPostRender().

Re: [Unity] AntialiasingAsPost messes up UI

Posted: 05 Sep 2014, 02:24
by jsantos
Patch officially incorporated in v1.1.11