Basp
Topic Author
Posts: 22
Joined: 08 May 2014, 10:09

[Unity] AntialiasingAsPost messes up UI

03 Jun 2014, 16:16

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?
 
wckdspn
Posts: 67
Joined: 18 Aug 2012, 23:14

Re: [Unity] AntialiasingAsPost messes up UI

03 Jun 2014, 20:05

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;
}
 
Basp
Topic Author
Posts: 22
Joined: 08 May 2014, 10:09

Re: [Unity] AntialiasingAsPost messes up UI

04 Jun 2014, 10:42

Thank you very much, that worked like a charm!
 
User avatar
ai_enabled
Posts: 231
Joined: 18 Jul 2013, 05:28
Contact:

Re: [Unity] AntialiasingAsPost messes up UI

23 Aug 2014, 06:41

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().
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: [Unity] AntialiasingAsPost messes up UI

05 Sep 2014, 02:24

Patch officially incorporated in v1.1.11

Who is online

Users browsing this forum: Semrush [Bot] and 79 guests